Storing data 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,
 
Add the job code field to your query and change the row source of your combo
box to include this as the third column in your combo (called ComboBox in my
example).
Then, in the control source property of the job code field on your form put
this
=ComboBox.Column(2)
 
Thanks Dennis, I renamed my combobox to combobox, added Job code to the query
and addd this to my job code field on the form =combobox.column(2) however I
get this error:

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.

Any help greatly appreciated. Thanks.
 
Just done the same on a test DB of mine and it works fine. Post your row
source property of your combobox and the control source property of your job
code field please
 
Hi Dennis,
Thanks again for your help. The row source for my combobox is this:
SELECT [Employee Information Table].[lastname]+", "+[firstname] AS [Employee
Name], [Employee Information Table].[Employee ID], [Employee Information
Table].[Job Code], [Employee Information Table].[Emp Status] FROM [Employee
Information Table] WHERE ((([Employee Information Table].[Emp Status])="a" Or
([Employee Information Table].[Emp Status])="t")) ORDER BY [Employee
Information Table].[lastname]+", "+[firstname];

The control source for my Job Code field is from my Time Off Request table
and is: OT Job Code.

Thanks.
 
The Job Code field on your form should not be bound to a field in the table.
It is there just to display the job code field when you make a selection from
the combo box. The control source for this field should therefore be
=Combobox.Column(2)

Sherry N. said:
Hi Dennis,
Thanks again for your help. The row source for my combobox is this:
SELECT [Employee Information Table].[lastname]+", "+[firstname] AS [Employee
Name], [Employee Information Table].[Employee ID], [Employee Information
Table].[Job Code], [Employee Information Table].[Emp Status] FROM [Employee
Information Table] WHERE ((([Employee Information Table].[Emp Status])="a" Or
([Employee Information Table].[Emp Status])="t")) ORDER BY [Employee
Information Table].[lastname]+", "+[firstname];

The control source for my Job Code field is from my Time Off Request table
and is: OT Job Code.

Thanks.




Dennis said:
Just done the same on a test DB of mine and it works fine. Post your row
source property of your combobox and the control source property of your job
code field please
 
Further to my last post, if you do want the job code bound to a field in your
table then put this in the after update event of the combo box and leave the
control source as you have it below.
[Job Code] = ComboBox.Column(2)

Sherry N. said:
Hi Dennis,
Thanks again for your help. The row source for my combobox is this:
SELECT [Employee Information Table].[lastname]+", "+[firstname] AS [Employee
Name], [Employee Information Table].[Employee ID], [Employee Information
Table].[Job Code], [Employee Information Table].[Emp Status] FROM [Employee
Information Table] WHERE ((([Employee Information Table].[Emp Status])="a" Or
([Employee Information Table].[Emp Status])="t")) ORDER BY [Employee
Information Table].[lastname]+", "+[firstname];

The control source for my Job Code field is from my Time Off Request table
and is: OT Job Code.

Thanks.




Dennis said:
Just done the same on a test DB of mine and it works fine. Post your row
source property of your combobox and the control source property of your job
code field please
 
Thank you, thank you, thank you. Bless your heart!

Dennis said:
Further to my last post, if you do want the job code bound to a field in your
table then put this in the after update event of the combo box and leave the
control source as you have it below.
[Job Code] = ComboBox.Column(2)

Sherry N. said:
Hi Dennis,
Thanks again for your help. The row source for my combobox is this:
SELECT [Employee Information Table].[lastname]+", "+[firstname] AS [Employee
Name], [Employee Information Table].[Employee ID], [Employee Information
Table].[Job Code], [Employee Information Table].[Emp Status] FROM [Employee
Information Table] WHERE ((([Employee Information Table].[Emp Status])="a" Or
([Employee Information Table].[Emp Status])="t")) ORDER BY [Employee
Information Table].[lastname]+", "+[firstname];

The control source for my Job Code field is from my Time Off Request table
and is: OT Job Code.

Thanks.




Dennis said:
Just done the same on a test DB of mine and it works fine. Post your row
source property of your combobox and the control source property of your job
code field please

:

Thanks Dennis, I renamed my combobox to combobox, added Job code to the query
and addd this to my job code field on the form =combobox.column(2) however I
get this error:

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.

Any help greatly appreciated. Thanks.




:

Add the job code field to your query and change the row source of your combo
box to include this as the third column in your combo (called ComboBox in my
example).
Then, in the control source property of the job code field on your form put
this
=ComboBox.Column(2)

:

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