forms autolookup

M

MES

I have created a data-entry form. In this form, I enter new employees'
demographic information and dept/job codes. In my Employee table, department
# and job code are foreign keys from respective tables. I have created 2
combo boxes that show department # and description, as well as job code and
title in the drop-downs. However, what I would like to do is be able to
select a department # (for example), and then have the dept. description
populate into another field in the form automatically once the dept. # is
selected. Does anyone know how to do this?
 
R

Rick Brandt

MES said:
I have created a data-entry form. In this form, I enter new
employees' demographic information and dept/job codes. In my
Employee table, department # and job code are foreign keys from
respective tables. I have created 2 combo boxes that show department
# and description, as well as job code and title in the drop-downs.
However, what I would like to do is be able to select a department #
(for example), and then have the dept. description populate into
another field in the form automatically once the dept. # is selected.
Does anyone know how to do this?

Ordinarily you don't want to copy data from related tables except for the
foreign key. However; it is a perfectly good practice to *display*
additional fields from the related table. I would do this by adding those
additional fields as hidden columns in your ComboBoxes. Then you can
display the extra columns in TextBoxes using a ControlSource expression
like...

=ComboBoxName.Column(n)

....where 'n' is the zero-based ordinal position of the column you want to
display.
 
M

MES

That works - thank you very much!



Rick said:
I have created a data-entry form. In this form, I enter new
employees' demographic information and dept/job codes. In my
[quoted text clipped - 5 lines]
another field in the form automatically once the dept. # is selected.
Does anyone know how to do this?

Ordinarily you don't want to copy data from related tables except for the
foreign key. However; it is a perfectly good practice to *display*
additional fields from the related table. I would do this by adding those
additional fields as hidden columns in your ComboBoxes. Then you can
display the extra columns in TextBoxes using a ControlSource expression
like...

=ComboBoxName.Column(n)

...where 'n' is the zero-based ordinal position of the column you want to
display.
 

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