Requery a form based on a Query

G

Guest

How does one requery a form that is based on a query?

I have a review data form that pulls data from 5 table. The user can then
edit the data by clicking a button which opens another form to allow edits.
When the user click Save and Close, the original review data form is still
open, but the data displayed is based on the orginal query values when the
form was first opened.

I would like the form to display the newly saved information.


Any help would be appreciated.

Cheers
 
G

Guest

Thanks Matt,

I already have the requery coded. However, it does not re-run the query that
the form is based on, therefor, until I close that form and re-open it, it
does not display the new info.
 
G

Guest

Make sure the data in Form1 is saved. After the user edits the data in
Form2, make sure that data is saved. Then Requery Form1. To save the data
in a form use:
If Me.Dirty Then Me.Dirty = False

If the Form has calculated fields then you would also need to recalculate.
Me.Requery
Me.Recalc

Is the data in a subform? Then the syntax would be
Forms!YourSubformControlName.Requery
 
G

Guest

Hi Matt,

I already have the information being saved in the Modify Record form. When
the focus returns to the Review Records form, the newly modified data is not
displayed. I have the OnGotFocus event coded to requery, but all this appears
to do is look at the original query when the form first opened.

I do not know how to best handle getting the query to update and redisplay
in the form. Should I close the Review Record form during the OnGotFocus and
reopen or is there a better way?

Cheers
 
G

Guest

In the AfterUpdate event of the Modify Record Form code:

Private Sub Form_AfterUpdate()
Forms!frmReviewRecords .requery
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top