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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh and/or Requery Help

Status
Not open for further replies.

camelk

Technical User
Mar 19, 2002
26
US
I need help w/'refresh' and/or 'requery'on a form. I have frmA that has a combo box on it. This combo box allows the user to select a person's name. Making a selection in the combo box then populates the rest of text boxes on the form. If the name you want is not in the combo box, you then click a cmd button that takes you to frmB so that you can add the name to the table (frmA stays open while you are working on frmB). My problem is that when I close frmB and return to frmA the info in the combo box has not been updated. I think the problem is that frmA never closes and therefore the combo box on frmA isn't updated. I tried refreshing the combo box, as well as frmA, but nothing worked.
Thanks in advance.
 
Try issuing a REQUERY on the combo box in form A just before you close formB.

The help system is extremely confusing on this issue, between REPAINT, REFRESH and REQUERY. I just remember that a REQUERY always reloads the data for an object, e.g. re-runs the query source for a combo box, etc. Refresh is 'suggested' when you are working in a multiuser database, to see record changes/deletes/edits.




Ex-JimAtTheFAA
78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Ex-JimAtTheFAA
And just how but how do I issue a requery on the combo box in frmA before I close frmB???? I'm really new at all this and need explicit instructions. Thanks
 
Try this. On the form properties, setup an On Activate event (I'm assuming you're using Access2k.) Go to the Code Builder. Under the Private Sub Form_Activate(), enter Me.Refresh. That should do it. I had the same problem and picked up this tip in an Access class I recently took. The final code looks like this:

Private Sub Form_Activate()
Me.Refresh
End Sub

Hope this helps!
 
CamelK, the post from Lifegard2 should answer your question, with the minor adjustment from me that the Form_activate event he's talking about should be in formA of your example.

The Activate event runs whenever the form receives the focus, so it should run when you bounce back to it from formB.

Let us know if you still encounter resistance from the program... Ex-JimAtTheFAA
78.5% of all statistics are made up on the spot.
Another free Access forum:
 
I entered the On Activate code for frmA but the results were less than satisfactory....the combo box got updated, but when I selected the new name in the combo box on frmA (remember I entered the new name and other info about the person on frmB) the rest of the text boxes on the frmA were not updated with the correct information. In fact, the rest of the text boxes on frmA were populated with data from the first record in the table. This has been the problem all along. I can't get the other text boxes on frmA to populate correctly when I select the new name in the combo box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top