Multiple column combo box

Araml

New member
Local time
Today, 19:45
Joined
May 4, 2020
Messages
22
When I use a criteria in a query such as [Forms]![FormName]![ComboBoxName] is there a way to use a value from another column other than the first.
For example, I have a combo box that shows the following records: NameID | CityID. Can I use the record of the cityID in the combo box to search records in other combo boxes?

Thank you for your help
 
Hi. Yes, try using the Column() property. It's zero based, so column #1 is Column(0).
 
I'm sorry but I'm new to Access and SQL. Can you elaborate how to do that please?
 
Query object will not recognize Column() property. If you use an SQL statement in RowSource and comboboxes are all on same form, don't need full path.

SELECT fieldname FROM tablename WHERE somefield = [comboboxname].Column(2);
 
Last edited:
I created this thread because I need both the record of the selected NameID and CityID.
About not using Name, it was an example. All my objects are in portuguese, so there's no risk in using reserved words.
 
I edited my post after you read it. Review again.
 
When I try to use the combo box it says "Undefined function 'Combo33.Column' in expression"
 
Post your code. Need column index parameter. Combo33.Column(1)
 
SELECT T_Artigo.tamanho, T_Artigo.cor, T_Artigo.nomeID
FROM T_Artigo
WHERE (((T_Artigo.cor)=Combo33.Column(2)) AND ((T_Artigo.nomeID)=[Forms]![Visualizar artigos]![Combo19]));
 
SELECT T_Artigo.tamanho, T_Artigo.cor, T_Artigo.nomeID
FROM T_Artigo
WHERE (((T_Artigo.cor)=Combo33.Column(2)) AND ((T_Artigo.nomeID)=[Forms]![Visualizar artigos]![Combo19]));
Hi. If that doesn't work (because of what @June7 was saying about using the Column() property in queries), then you could just add a hidden textbox on your form and use the Column property there. For example:

=[Comb33].[Column](2)

Then, in your query:

...T_Artigo.cor=Forms!FormName.HiddenTextboxName

Hope that helps...
 
Query object would need full path reference but as I said, will not recognize Column() property regardless. If you have SQL statement in combobox RowSource, then it would work.
 
Hi. If that doesn't work (because of what @June7 was saying about using the Column() property in queries), then you could just add a hidden textbox on your form and use the Column property there. For example:

=[Comb33].[Column](2)

Then, in your query:

...T_Artigo.cor=Forms!FormName.HiddenTextboxName

Hope that helps...

I can never make my text boxes function properly.
I tried a combo box after update event where Me.TextBox = Me.ComboBox.Column but it didn't work
 
I can never make my text boxes function properly.
I tried a combo box after update event where Me.TextBox = Me.ComboBox.Column but it didn't work
Hi. No need to use code. In the hidden textbox, simply type in the following (including the equas sign):

=[ComboboxName].[Column](2)
 
All I can say is it works for me. If you want to provide db for analysis, follow instructions at bottom of my post.
 

Users who are viewing this thread

Back
Top Bottom