How to refer to a column in a multiple-column combo box (1 Viewer)

sdp_tws

Registered User.
Local time
Today, 13:58
Joined
Apr 29, 2009
Messages
28
I found this in the tips section:
You need to create an expression that refers to the Column property of the list box or combo box control.
The syntax follows the form:

[Forms]![Form Name]![Combo Box Control Name].[Column](n)

Amend the Form Name and Combo Box Control Name and enter the column number n, where n will be one less than the actual column number because Access counts from zero for column one and so on.

Only I can't get it to work, I am typing
[Forms]![Staff_Training_Search]![Combo37].[Column](1)
and the error message I get is
Undefined function '[Forms]![Staff_Training_Search]![Combo37].[Column]' in expression.

I'm using Access 2003, can anyone explain what I am doing wrong?
 

DCrake

Remembered
Local time
Today, 13:58
Joined
Jun 8, 2005
Messages
8,632
Depends where you are referring to it but the coloumn(n) does not need to be in square brackets

Example

x = Forms("FormName")("ComboBoxName").Column(n)

David
 

namliam

The Mailman - AWF VIP
Local time
Today, 14:58
Joined
Aug 11, 2003
Messages
11,695
n is Zero based though, meaning the first column is 0
The second column is 1
etc..
 

sdp_tws

Registered User.
Local time
Today, 13:58
Joined
Apr 29, 2009
Messages
28
Depends where you are referring to it but the coloumn(n) does not need to be in square brackets

Example

x = Forms("FormName")("ComboBoxName").Column(n)

David

Thanks, that looks like vbasic? I'm referring to it in the criteria field in a query.

n is Zero based though, meaning the first column is 0
The second column is 1
etc..

Yes, thanks. I'm referring to the second column (column 1).
 

JANR

Registered User.
Local time
Today, 14:58
Joined
Jan 21, 2009
Messages
1,623
Thanks, that looks like vbasic? I'm referring to it in the criteria field in a query.

You can't refrence the column property in a query, sorry. You can only use column(n) in a form.

JR
 

sdp_tws

Registered User.
Local time
Today, 13:58
Joined
Apr 29, 2009
Messages
28
You can't refrence the column property in a query, sorry. You can only use column(n) in a form.

JR

Ah, that explains it. But I could add a text box on the form, use that to refer to the column property, then refer the query to the text box?
 

Fear Naught

Kevin
Local time
Today, 13:58
Joined
Mar 2, 2006
Messages
229
Why would you want to refer to a column in a combobox other than the bound column for your query?
 

Users who are viewing this thread

Top Bottom