Syntax to refer to combo box in query

WinDancer

Registered User.
Local time
Today, 13:06
Joined
Oct 29, 2004
Messages
290
I am trying to limit returned records in a query to the match on an open form

The code below won't run; it is treating the match as a parameter instead of matching the referenced combo box on the open form.....

The two fields contained in the combo box are col(0) and col(1)

Like [forms]![frmchooseActivity]![combo6].col(0)

What is the correct way to reference the colums in a combo box?

Thanks,
Dave
 
Try:
[forms]![frmchooseActivity]![combo6].column(0)
 
No Change.
I did a search on google and learned that it is not possible to reference a combo box in a query- it must be done in VBA.
 
Interesting. Still, the syntax was not correct. Are you going to use a User Defined Function to return the value?
 
Since I own the code I will just add a field that combines the two columns I need as a single field. Then I can just use normal code to use it as a limiter.

The code I was trying to use is from a function I wrote to write records out of a pair of combo boxes that the users pair up on a form, and that was the function's way to collect the data and then write the records out.

Thanks,
Dave
 
Thanks Dave,
It sounds like you have the issue well under control.
 
You can too reference a combo box in a query. I do it all the time. What you cannot do though, is reference the columns collection of a combo box in a query. I ordinarily put the column value into a hidden text box on the form, then reference the hidden text box.
 

Users who are viewing this thread

Back
Top Bottom