Help with Requery

  • Thread starter Thread starter David Ehrenreich
  • Start date Start date
D

David Ehrenreich

I would like to requery a subform from another form. I
have forms in two seperate mdf files, and tables in
another(Frm1, Frm2) and i need frm1 to requery form 2
afterupdate. I have tried this method, but only works
when the form is in the same file.

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("frm2").IsLoaded Then

Forms![frm2]![frm2Sbfrm.Requery

End If

End Sub

I was wondering if currentProject has something to do
with
it?

Any help would be great.

Thank you
David Ehrenreich

..
 
The CurrentProject does have something to do with it. A subform won't show
up as IsLoaded. You need to see if the parent form is loaded then requery
from there. If the parent form is Frm1

Forms!Frm1!NameOfSubformControl.Form.Requery

The NameOfSubformControl is the name of the control on the main form that
holds the subform, not the name of the subform itself. However, if you
create the subform by drag and drop, by default Access will give the subform
control the same name as the subform it contains.
 
Back
Top