Click to See Complete Forum and Search --> : Heeeeelp: Syncronization problem when updating same table between forms


Nick A.
January 14th, 2000, 10:04 AM
Here's the situation:

I have a form in which i have a data control (or a variable of type recordset, it doesn't matter) which retrieves some records of a table A. From that form, i load another, which contains a grid. That grid is bound to a data control which updates the same table A. If (after i do an update in the grid) i close the form almost immediately, when i return to the previous form and i do a datacontrol.refresh, the data control does not reflect the updates i had done in form 2. Now, if i wait a couple of seconds before i close the second form, after the datacontrol.refresh in form 1 i see all the changes i had made in form 2.

The logic is as follows: just before i close form2 (and i've made sure that no data editing is pending) i do a form1.datacontrol.refresh and then i unload form2.

Question: is there a way, before i close form 2 to "tell" dao to write the updates to disk so when i do a form1.datacontrol.refresh and return to form1 i'll see my changes?

Note that DoEvents doesn't help. I've put many of them, even a 2 seconds delay (a loop executing DoEvents until 2 secs have passed) before i do the form1.datacontrol.refresh but nothing changed.

Aaron Young
January 14th, 2000, 11:35 AM
Refresh should work, if you want to make sure you can tell the Recordset to ReQuery, ie.

Data1.Recordset.Requery

This will make sure the Recordset has the Most Up-to-Date Data.

Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com

Nick A.
January 17th, 2000, 02:06 AM
Thanks for the suggestion. Unfortunately, it didn't work. I've even tried calling a function (located in form1) that has a local recordset variable and uses it to re-execute the same SQL statement as in the data control. Nothing. :( Anyways, it's probably just another problem that Uncle Bill has to solve.