Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data not refreshing until program is restarted

Status
Not open for further replies.

rene316

Programmer
Jan 14, 2002
81
US
Hello,
I am writing a tracking program for my company. On the main form, I have an add button that calls up another form for data entry. However, although the data does post to the database, when I get back to the main form, the data doesn't show up. If I stop the program and then start it again, then the data is there. I would like it to be there as soon as I leave the data entry form and get back to the main form. I am using and ADO control and have tried "refresh", "update", "resync", and "requery". I am still pretty new to VB and Database connection, so I am flying half blind, if not fully. Any suggestions?

Thx in advance,
Rene
 
I think the problem is partly that the removal of the second form doesn't refresh the first one - in other words, the details are exactly as you left them when the second form was called. Also, as you already have the relevant data in the buffer, it isn't automatically refreshed.
I've got round this problem by placing a non visible label on the first form called "lblRefresh" and setting it's caption to "YES" (via the second form) when the details need to change. Then after the SHOW method you used to display the second form have:
If lblRefresh = "YES" THEN
' Now execute a data refresh or get-data-again routine
Endif

You may find that the data refresh involves rebuilding the connection!
Hope this helps.
 
Simonkue,

Thanks for the reply, your code worked, but only after I hit add item again, not when I left the data entry screen. But I did figure it out thanks to you. On the form unload event I had placed adodc1.refresh, which wasn't working, then after thinking about it, I added a prefix to it: frmMain.adodc1.refresh, so as soon as i hit done to leave the data entry form, it refreshes the main form, which is what I want. Thank You once again, and mabye this will get you around using the label, thought I would let you know.

Thx,
Rene
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top