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

Requery Main Form from SubForm

Status
Not open for further replies.
May 7, 1999
130
US
This is a little more complicated that simply issuing a requery against the parent form in order to update the records in the main/parent form.

Instead of just a simple query, the main form first uses a bunch of combo boxes to select records to be displayed, the user then presses a command button on the main form to cause the selection to take place (using SQL for a SELECT and WHERE query) and then in the continuous form of the results it uses a little icon to go to the subform.

When a change is made to a record in the subform, I'd like the main form to be requeried. I've tried the parent.requery and that wasn't adequate. I then thought, "aha, if I just do a forms![formname].requery that should do it." That didn't work and, I presume, that's due to the fact that selecting records from the main form that then populates a continuous form a command button means that I'd have to "press" the command button to do the precise requery. If so, how do I "press" the command button in the main form using VBA in the subform?

All help is gratefully accepted!

Thanks,

John Harkins
 
What about doing this for the "On Data Change" Event for the form:

Private Sub Form_DataChange(ByVal Reason As Long)

Me.Requery
Forms!mainform_name!subform_name.Form!.Requery

End Sub

That might work

Let me know if it does work for you

Jerome Benton
JERPAT Web Designs
GOD Is Good All The Time!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top