Basing one combo box on another - doesn't work in subform

ashleybyrdnc

Registered User.
Local time
Yesterday, 23:20
Joined
Sep 27, 2006
Messages
17
I am trying to base one combo box (Combo28) off of another combo box (Combo16) value in a subform (NCRB2010Defects subform!). It works when I have the subform open by itself but when I put it in (NCRB2010) another form it gives me the following error enter parameter

Forms!NCRB2010Defects subform!Combo28

I have the following code attached to Combo28's After Update

Private Sub Combo28_AfterUpdate()

Me.Combo16 = Null
Me.Combo16.Requery
Me.Combo16 = Me.Combo16.ItemData(0)

End Sub


Can anyone tell me what I am doing wrong. Attached is the database if you'd like to see it.

Thanks
 

Attachments

I am trying to base one combo box (Combo28) off of another combo box (Combo16) value in a subform (NCRB2010Defects subform!). It works when I have the subform open by itself but when I put it in (NCRB2010) another form it gives me the following error enter parameter

Forms!NCRB2010Defects subform!Combo28

I have the following code attached to Combo28's After Update

Private Sub Combo28_AfterUpdate()

Me.Combo16 = Null
Me.Combo16.Requery
Me.Combo16 = Me.Combo16.ItemData(0)

End Sub


Can anyone tell me what I am doing wrong. Attached is the database if you'd like to see it.

Thanks


This how you reference a control in a subform from its parent form

NameOfSubformControl.Form!Combo28

Notice there are no spaces. If your control name has a space, put square brackets around them.
 
Last edited:
Is the NameOfSubformControl the name of the subform?

because I am still getting the same error with

NCRB2010DefectsSubform.Form!Combo28
 
Is the NameOfSubformControl the name of the subform?

because I am still getting the same error with

NCRB2010DefectsSubform.Form!Combo28


When you drag and draw a subform from the toolbox, that square you draw that is used to display the subform, is a control and not the subform. By default if you assigned a form to it during the process of creating subform, the name of the control will become the same name as the subform.

Confused? Rename your subform (without spaces), open your main form (NCRB2010) in design view. Click the "Other" tab, then click on your subform and look at the Name property in that Other tab. It's not the same. Click on it a second time, and you will find the focus moves inside to the actual subform and the Name property changes to what you renamed it.

Does this help?

A few things too, I don't see a Combo28 in your subform so I'm not sure where you got that name from.
 

Users who are viewing this thread

Back
Top Bottom