Dropdown to populate 2 fields

  • Thread starter Thread starter Sash
  • Start date Start date
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!
 
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.
 
Back
Top