Board index » delphi » TADOTable.Refresh doesn't work

TADOTable.Refresh doesn't work

When I add a new record in the master table of a master/detail form, I
automatically create a no. of detail lines in a AfterInsert event
handler. These detail line have never show up by their own in in the
TDBGrid that is connected to the detail table, but when I use BDE
components a DetailTable.Refresh will make them show up. After switching
to ADO components that didn't work any more. Now I have to close the
ADOTable and open it again to make the detail lines show up. Is there a
better way? I use an Access database.
 

Re:TADOTable.Refresh doesn't work


Call Requery instead.

--
Vassil Nazarov
http://web.orbitel.bg/vassil/

Re:TADOTable.Refresh doesn't work


Quote
> DetailTable.Refresh will make them show up. After switching
>to ADO components that didn't work any more. Now I have to close the
>ADOTable and open it again to make the detail lines show up. Is there a
>better way? I use an Access database.

Try DetailTable.Requery;
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:TADOTable.Refresh doesn't work


Thank's for your help,

ADOTable.Requery works, but there is a difference. While Refresh doesn't
change the active record, Refresh does that and the first record in the
record set becomes active.

Re:TADOTable.Refresh doesn't work


Try something like this :

SomeVar := ADOTable's PrimaryKeyFieldValue;
Try
  ADOTable.DissableControls;
  ADOTable.Requery;
  ADOTable.Locate(... SomeVar ....);
Finally
  ADOTable.EnableControls;
  End;

HTH
--
Vassil Nazarov
http://web.orbitel.bg/vassil/

Other Threads