CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 1999
    Posts
    128

    Heeeeelp: Syncronization problem when updating same table between forms

    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.


    -------------------------
    Nick A.

  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Heeeeelp: Syncronization problem when updating same table between forms

    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
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Dec 1999
    Posts
    128

    Re: Heeeeelp: Syncronization problem when updating same table between forms

    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.

    -------------------------
    Nick A.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured