Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subforms with Combo boxes

Status
Not open for further replies.

Beeps

Programmer
Aug 28, 2001
128
US
Hello all,

I have a data entry form with a subform attached. Within the subform there are two combo boxes that I have linked to a query so that the second combo box lists values based on the first. This works great when the subform is opened by itself. In the main form, however, I get "You can't use ApplyFilter on this window" error message.

I'm not sure what's going on, or if this is possible to have a subform with related combo boxes within a main form.

Any Ideas?? (Thanks for helping with my last question Alcar)
 
Not to sure but you might to want to try and add the DoEvents to your main forms OnLoad_Event()

This should allow your querys to run and fill your subform comboboxes before the main form is done loading.

When the main form is loading you can not filter your subform or run the queries. And your loads after your main form. The DoEvents will Allow everything else that needs to be done to happen before the main form loads.

HTH
 
Thanks for responding Toeshot!

After playing around with your idea, I came up with the solution.

The original criteria that I was using in the second combo box query was:
[Forms]![Subhours]![cboProjectIDNumber].

The reason that it worked by itself and not within the main form was that it seached the form and found the combo box when the subform was loaded by itself.

To correct the error message when the subform was loaded within the main form, I entered:

[forms]![entry]![Subhours].[form]![cboProjectIDNumber]

I just needed to address the main form (named Entry) in the criteria. Small, but critical piece of info.

Thanks for your help!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top