Requery a subForm

Bee

Registered User.
Local time
Today, 22:30
Joined
Aug 1, 2006
Messages
486
Hi,

I want to requery a SubForm using the on Click event of a combobox that is located on the main form. I used this code below, but it does not work.

Code:
Forms![frmSite]![subRoadsConstructionConsent].Requery

Any suggestions please,
B
 
think u have to have the container name of the subform to requery it.
http://www.mvps.org/access/forms/frm0031.htm

Ray is correct. Whenever you reference a subform you reference the CONTAINER that is on the main form and not the subform. But, the container CAN be the same name of the subform, which then makes it easier, but if the names are different then you have to use the container name.

Forms![frmSite]![subRoadsConstructionConsent].Requery should likely be:

Me.subRoadsConstructionConsent.Form.Requery (if the container is named subRoadsConstructionConsent)
 
It works, but it seems like it's always one step behind. When I update the combo the first time, the subform does not requery. When I update the combo the second time, then the subform requeries and shows the previous update. So it feels like it is always one step behind.

Any idea why it's doing that please?
B
 
put it in the afterupdate event of the combo box instead
 
put it in the afterupdate event of the combo box instead
I have instead set the focus to the subform just before I requeried it and it seems to work now.
 

Users who are viewing this thread

Back
Top Bottom