Passing criteria to a query

cindy007

Hit n Miss
Local time
Today, 13:13
Joined
Dec 11, 2002
Messages
16
Hi,
I have a form with 2 ComboBoxes, 1 holds all the months from 1 to 12 and the other holds years 2003 2004 etc etc. Why is it that I cant get my query to work using the ComboBoxes, yet if I use TextBoxes instead it works fine. I am using the format... [Forms]![Myform]![Combo1]
but my query does not produce results, yet if I use TextBoxes instead of ComboBoxes, the query runs OK ? What's the catch?

Cindy
 
Have you double-checked the Bound Column property on the combo?

Regards,
Tim
 
ComboBoxes and query

Yes, I am using 1 table for the dates and another for the Years and both only have an ID field and the Year and Month fields respectively. They are both bound to column 1, ID's (Autonumber) is in Column 0.
 
Are the combo boxes bound to a field in a table or query? Are the text boxes bound to a field in a table or query? Have you triple-checked for typos in the criteria field of the query?

Use debug.print (or the MSGbox function) to see the combo's actual values immediately before you run the code to open your query -- and yet: are you using code to run your query? If so, at what event do you run your query? Is the sun the source of all energy on our planet? If the combos are not bound to a field in a table or query, use the Setfocus or DoCmd.Goto method on each of them, one after the other, before opening your query.

Regards,
Tim
 
Try using the CLng() function around your criteria as I've sometimes had my autonumber change to a string in listboxes and comboboxes.


CLng([Forms]![Myform]![Combo1])
 

Users who are viewing this thread

Back
Top Bottom