Storing Values in Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box on my form where the row source is a query that shows me
the employees name and employee ID. I have it set to 2 columns and the bound
column is column 2 so that I can enter the name, but store the ID in the ID
field of my table.

Is there any way I can add a third column to the query to store the job code
in the job code field? I don't want to have to enter the employee name twice.

Thanks,
 
Hi there,
What you can do is set the control source (query) of the ComboBox to return
three fields but only display the first two but then use the third field to
store in the Job Code control. To explain further:
Assuming there are three columns and you want the first one only to show
then you'd set the Column Widths property to "4cm;0cm;0cm".
The Control Source of the Job Code field could then be set to:
=[the name of your combo box].[Column](2)
Access numbers the columns from zero so the third column is actually
referred to as column 2.
I hope this helps.
Lee
 
Hi Baby Face,
Thanks for your help. I am getting this error message:

The microsoft Jet database engine cannot find the input table or query
'=[ComboBox].[Column](2)'. Make sure it exists and that its name is spelled
correctly.

My combo box is named ComboBox, I have it set to 4 columns. In the query the
1st column is employee name, 2nd is employee ID, 3rd is Job Code, 4th is
employee status. Bound column is column 2 so that I see the name but store
the ID.

In the job code combo under the Row Source property I entered
=[ComboBox].[Column](2) and I received the above error when I try to run it.

Thanks for any help.



Baby Face Lee said:
Hi there,
What you can do is set the control source (query) of the ComboBox to return
three fields but only display the first two but then use the third field to
store in the Job Code control. To explain further:
Assuming there are three columns and you want the first one only to show
then you'd set the Column Widths property to "4cm;0cm;0cm".
The Control Source of the Job Code field could then be set to:
=[the name of your combo box].[Column](2)
Access numbers the columns from zero so the third column is actually
referred to as column 2.
I hope this helps.
Lee

Sherry N. said:
I have a combo box on my form where the row source is a query that shows me
the employees name and employee ID. I have it set to 2 columns and the bound
column is column 2 so that I can enter the name, but store the ID in the ID
field of my table.

Is there any way I can add a third column to the query to store the job code
in the job code field? I don't want to have to enter the employee name twice.

Thanks,
 
I found the answer, thanks.

Sherry N. said:
Hi Baby Face,
Thanks for your help. I am getting this error message:

The microsoft Jet database engine cannot find the input table or query
'=[ComboBox].[Column](2)'. Make sure it exists and that its name is spelled
correctly.

My combo box is named ComboBox, I have it set to 4 columns. In the query the
1st column is employee name, 2nd is employee ID, 3rd is Job Code, 4th is
employee status. Bound column is column 2 so that I see the name but store
the ID.

In the job code combo under the Row Source property I entered
=[ComboBox].[Column](2) and I received the above error when I try to run it.

Thanks for any help.



Baby Face Lee said:
Hi there,
What you can do is set the control source (query) of the ComboBox to return
three fields but only display the first two but then use the third field to
store in the Job Code control. To explain further:
Assuming there are three columns and you want the first one only to show
then you'd set the Column Widths property to "4cm;0cm;0cm".
The Control Source of the Job Code field could then be set to:
=[the name of your combo box].[Column](2)
Access numbers the columns from zero so the third column is actually
referred to as column 2.
I hope this helps.
Lee

Sherry N. said:
I have a combo box on my form where the row source is a query that shows me
the employees name and employee ID. I have it set to 2 columns and the bound
column is column 2 so that I can enter the name, but store the ID in the ID
field of my table.

Is there any way I can add a third column to the query to store the job code
in the job code field? I don't want to have to enter the employee name twice.

Thanks,
 
Back
Top