use only part of listbox etry for query?

moori

Registered User.
Local time
Today, 11:54
Joined
Feb 8, 2012
Messages
31
Hi guys,

I want to run a query based on a list box entry. For more user friendliness I want the list box to show both an ID number an a name, but the query shall only run on the number.
Is there a (VBA-) way to read only part of the list box entry into the query?

Or can I somehow concatenate the list box entries from two fields and use only one of them for the query?

I'd be happy about any hints,

moori
 
You can refer to any column of a list or combo box in a query, but typically the bound column is what is used. So if you have the ID as the bound column then your query should refer to that.

SELECT...
FROM...
WHERE yourfield=forms!formname!comboboxname

If you want to use another column, you have to specify which column in the query


SELECT...
FROM...
WHERE yourotherfield= forms!formname!comboboxname.column(x)

x= the number of the column that holds the data you want to use. (Note: Access starts numbering list/combobox fields at zero not 1)
 
Aaaaahhh! I didn't know that you can set up several columns in a list box :o
That solves a lot of my problems!
Thanks!!
 

Users who are viewing this thread

Back
Top Bottom