Cascading Combo boxes in subform - Need Help

sdzc

Registered User.
Local time
Today, 13:21
Joined
Mar 27, 2004
Messages
46
I have cascading combo boxes in a subform. When I click the second box, which is dependent on the first, I get the following error:

"Object does not support this property or method"

This is what I have for the On Enter Event:

Me!LeadIn.Updated Form!LeadIn.Requery

I originally had : Me.LeadIn.Requery for the On Enter, but it prompted a parameter box looking for the Phone_Card form.

I think I have to adjust the OnEnter even syntax, but I cannot figure it out.

Here are the names of the forms:
Main Form: Updated Form
SubForm: Phone_Card

Control Names:

Combo Box 1: Brand
Combo Box 2: LeadIn

In doing a net search, I believe it should look something like this:

Me!Leadin.Form!leadin.requery ??

I should also add that the subform is in a tab control: TabCtl197 if that matters. Also, when I use the combo boxes while having the Phone_Card form open, they work fine. It is only when using it as a subform that it no longer works.

Thanks for any advice or help!
 
Last edited:
Subform syntax can be "taxing" at first. This is what you should have:
Code:
Forms!LeadIn.[Updated Form].Form.LeadIn.Requery
This is assuming that your main form is called "LeadIn" and your SubForm CONTROL is named "Updated Form" - The subform control name is required, and while by default it is usually the same as the subform itself, it doesn't have to be. So, if it IS the same that is okay, but if not then you have to refer to the CONTROL name and not the SUBFORM name.

Also, by using ME in the code, you are referring to the current form that has the focus. So, if the code is on the subform and you are referring to the subform control, then you CAN use:
Code:
Me.LeadIn.Requery
But if the code that requeries the subform control is on the Main Form, then the first code is what is needed. Also, if you have spaces in the names of your objects you either need to put them in double quotes or square brackets (they are not necessarily interchangeable and you need to know when to use each - hence it is better to not have spaces in your object names and then you don't have to figure that out).
 
Thank you!
 

Users who are viewing this thread

Back
Top Bottom