Query question about Comboboxes and columns

BJF

Registered User.
Local time
Today, 04:02
Joined
Feb 19, 2010
Messages
137
Hello,

Is it possible to reference columns of a combobox in a query on another form?

Thanks for any information,
BJF
 
Well you can reference a form control in a query, so why not just try. Remember they start at 0
 
The trick is to remember that TWO items are needed to reference a combo box column - the column and the row. IF you have a single-select combo, the selected row is defaulted. If it is a multi-select combo, then you need to iterate through the rows to check for the .Selected property, or use the .ListIndex to determine which row was selected for the single case. There is also the hidden collection .ItemsSelected for multi-select only.


 
I was only considering a single select combo? Not seen multi select combos, but then I only have 2007
 
Think doc mean list box

to reference a combo column the syntax is

Forms!otherformname.Comboname.column(1)

to reference the 2nd column but not sure that will work in a query

Try using the expression builder
 
Multiselect combos are only available when using multivalued fields...which of course should be avoided like the plague
 
Is it possible to reference columns of a combobox in a query on another form?
No. If I'm going to need to reference other columns in a query, I do one of two things,
1. copy them to hidden textboxes and reference those
2. Join the query for the form to the lookup (use a left join) and bind the lookup values to visible textboxes. Remember, if you do this, you should lock the control to prevent accidental editing and I also set the IsTabStop property to No so the user just tabs over the fields.
 
To those who question multi-select combo boxes, please see:


 
I was not questioning it Doc, just that I was not aware of them, and so my answer was just for a single select combo :(
 

Users who are viewing this thread

Back
Top Bottom