I have a main form (MyMainform) that has a subform (MySubform) attached. On the subform, I have a set of dependent comboboxes: cboRegion and cboState. To illustrate, when the user selects "Southeast" from cboRegion, the only states available in cboState are AL, GA, TN, etc. Likewise, when the user selects "Northeast", then the states available are MA, CT, ME, etc.
The problem is, when I open up just the subform from the Access Objects and make my selection in cbo Region, cboState adjusts accordingly. However, when I open the main form that has the subform attached and attempt to do the same I get a message box asking me to enter a parameter value.
Here is the code I have in the AfterUpdate event for cboRegion:
Private Sub cboRegion_AfterUpdate()
Me.cboState.Requery
End Sub
Here is the Row Source sql I have for cboState:
SELECT [tblRegions].[RegionID], [tblRegions].[RegionName] FROM tblRegions WHERE [tblRegions].[StateID] =Forms!sfrmMySubform.StateID ORDER BY [RegionName];
What am I missing? Why does it work properly on the subform only but not on the subform attached to the main form?
Please help!
Thanks,
Jamie