Select second column from combo (1 Viewer)

Gismo

Registered User.
Local time
Today, 16:23
Joined
Jun 12, 2017
Messages
1,298
Hi,

I have a combobox with 2 values, registration and work pack number
i need a query to only display the registration and the work pack number selected in the combo.
I have my query that displays the selected registration but can not get it to only display the work pack number from combo

Registration code is :
Code:
 [Forms]![SB/AD Menu]![RegistrationNo]

Work pack number which i tried was:
Code:
[Forms]![SB/AD Menu]![RegistrationNo.Column(1)]

Please could you assist?
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 01:23
Joined
Jan 20, 2009
Messages
12,849
This will return the column from the combo.
Code:
[Forms]![SB/AD Menu]![RegistrationNo].Column(1)

However it will not work if referred to directly in a query. The column expression can be used as the ControlSource for a textbox which can then be used in a query. Or concatenate into a code based query.

BTW Bad idea to use a special character such as a slash in an object name.
 

Minty

AWF VIP
Local time
Today, 14:23
Joined
Jul 26, 2013
Messages
10,355
You can't refer to anything other than the bound column in a query like that. Easy solution is to set a hidden txtControl on the form and set it's value to column(1) in the combo's after update event. Then use the hidden txt control as the criteria in your query

However if you can pull this information into a combo , then you could probably use a join in the query ?
 

Gismo

Registered User.
Local time
Today, 16:23
Joined
Jun 12, 2017
Messages
1,298
After entering the code to the control source, it auto corrects as
Code:
Forms![SB/AD Menu]![RegistrationNo]].[Column(1)]
then show the control as #Name?
 

Users who are viewing this thread

Top Bottom