0

I need a join table from table 1 and table 2 and be able to apply updates on it so here's my SQL:

select 
    table1.ackode, tabble1.ket,
    table1.debet, table1.kredit, 
    (select table2.ket from table2  
     where table2.kode = table1.ackode 
       and table2.ptlokasi = table1.ptlokasi) as x 
from table1;

This resulted in a dbgrid like this :

enter image description here

now, whenever I click on ackode column, it'll open another form which I can select data from it. I wanted ACKODE and X column changed according to data values I've selected in that new form. However, it raised error as X column cannot be written. is there any idea how to make it possible? I've set the X column's readonly property to false, however no such luck. Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
mizkyd
  • 75
  • 1
  • 11
  • I have no idea about the dbgrid you are using and whether it supports updates like this, but what I would try is changing the correlated sub query you have to get table2.ket into a simple join between table1 and table2. – TomC Sep 17 '18 at 03:52
  • @TomC applyupdates won't work in joined tables but I figured out a way for this. I simply created a calcfield. Thanks for your input! – mizkyd Sep 17 '18 at 04:55
  • Your query is not a joined table, it just fetches a value thru a subquery. Anyway what dataset are you using ? You might get this done by setting the ProviderFlags of X to false and Readonly to false at the same time – GuidoG Sep 19 '18 at 12:30
  • @GuidoG I know I'm not joining table. Readonly is already set to false but it doesn't work. however, I solved my needs with calcfield. Thanks for the idea! – mizkyd Sep 20 '18 at 04:31

0 Answers0