Requery AfterUpdate doesn't

Steven811

Registered User.
Local time
Today, 16:55
Joined
Apr 18, 2004
Messages
133
Hi

I have a control on a subform that I want to requery when the data changes. The following code doesn't show any error messages, although it doesn't work either.

Private Sub cboLocation_AfterUpdate()
Forms![MainForm]![SubForm1]![SubForm2]!cboLocation.Requery
End Sub

There are no breakpoints.

Any suggestions would be welcome.

Thanks

Steven811
 
If you need to requery a subform from a main form then:

Me!subformControlName.Form.Requery

If you are on a subform and you want to requery a main form's records then do this:

Me.Parent.Requery

Or to requery a different sub form from a subform all on the same main form:

Me.Parent!subformControlName.Form.Requery

hth,

Michael
 
Hi Michael

I've been looking at this problem for 2 days and my head is fuddled.

I have used the following:

Private Sub cboLocation_AfterUpdate()
Me.Parent!cboLocation.Form.Requery
End Sub

The error message says that Access can't find the field cboLocation.

My intention is to update the 2nd subform, ie main form, sub form1, subform2 and use that as selction criteria in another combo box for grouping. The forms are all sourced through queries.

F9 does exactly what I want to automate

Any suggestions would be well received.

Thanks

Steven
 
The error message says that Access can't find the field cboLocation.

That because you're trying to requery the combo box. You need to put you subform name.

Me.parent!subformname.Form.Requery

hth,

michael
 
I feel really dim

Hi

Thanks for that, I became fixated with the combo box.

It now works.

Thanks

Steven811
 

Users who are viewing this thread

Back
Top Bottom