Dropdown to populate 2 fields

S

Sash

I have a dropdown box that displays an employee name. However, I want to
populate the employee number field as well as the name field in the table
Procedures. The dropdown is pulling from table called Employee and I'm
trying to populate the two fields in a table called Procedures. I know that
I'm somehow making this more difficult than it needs to be. Any help would
be greatly appreciated!
 
R

Rick Brandt

Sash said:
I have a dropdown box that displays an employee name. However, I
want to populate the employee number field as well as the name field
in the table Procedures. The dropdown is pulling from table called
Employee and I'm trying to populate the two fields in a table called
Procedures. I know that I'm somehow making this more difficult than
it needs to be. Any help would be greatly appreciated!

What you are doing incorrectly is trying to store the employee name. When
storing data in related tables ONLY the primary key of the related table should
be stored as a foreign key. Any other data from the related table that you want
to *display* can be done by using various lookup methods to pull it from its
home table. This way you are not redundantly storing the same data in multiple
places.

In your case the ComboBox should show the name but store the ID. If you want to
also *display* the ID then place a TextBox nearby with a ControlSource of...

=ComboBoxName.Column(n)

....where n is the zero-based column number that 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