Query in a subform

JaredNJames

Registered User.
Local time
Today, 07:11
Joined
Jul 7, 2007
Messages
87
Hi, i have a simple setup in a datasheet view which is as follows with three fields: Combo11, Combo13, Price.

It works like this:
User selects part type in combo11, the afterupdate event requeries combo13, the user then selects the name of the part in combo13, which then requeries the price field, which then displays a price.

this setup works perfectly when on a standalone form, but when i set this as a subform it doesnt, i can choose the first combo11, (i can choose the part type), but it doesnt requery combo13 to bring up the next options. this means when i click on combo13 it asks me to enter the criteria manually. If i enter the criteria manually i can then continue as normal. However i cannot see why it would suddenly not work. I think it could be down to the first query event not being able to see combo11

Im not sure why it works as a standalone and not in subform so any ideas welcomed.

Thanks
Jared James
 
The problem lies in that when you move a form to being a subform the syntax that is in the query for referring to the first combo box changes. So, my suggestion to get the right syntax is to open the main form in design view, after you have inserted the subform. Click on the gray square on the top left of the subform control until it gives you a black square within the gray square (means you have selected the subform and not the subform container) and then click on the second combo and then click on the rowsource property (the ellipsis ...) so that the query opens then click in the critera and click the expression builder and navigate FORMS > LOADED FORMS > and then down through the main form and then subform and then combo box (double click on the combo box name) and it will return the right syntax for the subform.

You can also try typing it manually (in the criteria of the combo's rowsource query):

[YourSubFormContainerName]![Form]![YourComboBoxNameHere]
 
nice one mate, would never have figured it out. ive been trying for ages.

i looked at everything, even checked that but i though it looked ok, and because it worked in a normal form.

Many Thanks
Jared James

p.s. i cant see the scales symbol for your name, where is it?
 

Users who are viewing this thread

Back
Top Bottom