Set value in one field based on selection from lookup field

J

JudyB

I have a form with the following fields:
empid, deptname, jobtitle, lop, datein, dateout, servicetime.
The jobtitle field is a lookup field that comes from a table with these
fields: jobtitleid, jobtitle, and lop.
When the user selects the desired jobtitle from the form, I want the
corresponding lop value to automatically be entered into the lop field. Can
someone please provide help? Thanks in advance!
 
J

John W. Vinson

I have a form with the following fields:
empid, deptname, jobtitle, lop, datein, dateout, servicetime.
The jobtitle field is a lookup field that comes from a table with these
fields: jobtitleid, jobtitle, and lop.
When the user selects the desired jobtitle from the form, I want the
corresponding lop value to automatically be entered into the lop field. Can
someone please provide help? Thanks in advance!

Actually, you don't. If the lop can be determined based on the jobtitle, it's
redundant and unnecessary to store it in any other table. Just look it up
based on a Query joining the two tables; or to display it on the form, include
it in the combo box's Rowsource query and set the control source of a textbox
to

=comboboxname.Column(n)

using the name of the job title combo box, where (n) is the zero based index
of the lop field in the query.
 
B

broncojim

John,

When I set this the control source of the text box =cbxSECVOLT.column(3), it
automatically gets changed to =[cbxsecvolt].[column](3). There is no
resulting data in the text box. Anything else to check?

Thanks,

Jim
 
B

broncojim

John,

This is not working for me. I set the control property of the text box to
=cbxSECVOLT.column(3) and it gets changed to =[cbxSECVOLT].[COLUMN](3).
There is no resulting data in the text box. Any ideas?

Thanks,

Jim
 
B

broncojim

John,

This is not working for me. I set the control property of the text box to
=cbxSECVOLT.column(3) and it gets changed to =[cbxSECVOLT].[COLUMN](3).
There is no resulting data in the text box. Any ideas?

Thanks,

Jim
 
B

broncojim

Sorry about the multiple posts. I kept getting a "failed" message.

Jim

broncojim said:
John,

This is not working for me. I set the control property of the text box to
=cbxSECVOLT.column(3) and it gets changed to =[cbxSECVOLT].[COLUMN](3).
There is no resulting data in the text box. Any ideas?

Thanks,

Jim

John W. Vinson said:
Actually, you don't. If the lop can be determined based on the jobtitle, it's
redundant and unnecessary to store it in any other table. Just look it up
based on a Query joining the two tables; or to display it on the form, include
it in the combo box's Rowsource query and set the control source of a textbox
to

=comboboxname.Column(n)

using the name of the job title combo box, where (n) is the zero based index
of the lop field in the query.
 
J

John W. Vinson

John,

When I set this the control source of the text box =cbxSECVOLT.column(3), it
automatically gets changed to =[cbxsecvolt].[column](3). There is no
resulting data in the text box. Anything else to check?

What is the Rowsource of the combo? Does it have a fourth column (Column is
zero based so (3) means the fourth)? If you open the rowsource as a query
datasheet is the data you expect visible in the fourth column?
 
E

Eugene

John,

While I am not the original poster. This was exactly what I was looking for ..

Thanks

John W. Vinson said:
John,

When I set this the control source of the text box =cbxSECVOLT.column(3), it
automatically gets changed to =[cbxsecvolt].[column](3). There is no
resulting data in the text box. Anything else to check?

What is the Rowsource of the combo? Does it have a fourth column (Column is
zero based so (3) means the fourth)? If you open the rowsource as a query
datasheet is the data you expect visible in the fourth column?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top