Insert two values with one Combo Box

  • Thread starter Thread starter Closemofo
  • Start date Start date
C

Closemofo

Hello,

I have a table source (fields ID + Name)

With one combo box, I would like to copy these two fields towards
another table.

In fact I wish that the combo box selects field ID and copy the
two fields (ID + Name) in the second table.

How to make?
 
Closemofo said:
Hello,

I have a table source (fields ID + Name)

With one combo box, I would like to copy these two fields towards
another table.

In fact I wish that the combo box selects field ID and copy the
two fields (ID + Name) in the second table.

How to make?

Maybe I don't understand you correctly, but if I do, this is probably
something you should not do. Storing the same information in more than
one place is a violation of the principles of relational database
design, and potentially leads to conflicting information stored in the
database. Normally, if you have a table containing fields ID (primary
key) and Name (some "name" information that pertains to that ID), then
no other table should store the Name value, just the ID. Any time you
need to know the name that relates to the ID, you can use a query to
look it up from the table where it is stored, or by invoking a lookup
function such as DLookup, or in some cases by picking it up from a
location where it has already been queried.

For example, if you just want the form that has the combo box also to
show -- but not store -- the Name value that is in the second column of
the combo box, you can put a text box on the form that has something
like this as its ControlSource:

=[YourComboBox].[Column](1)

where "YourComboBox" is the name of the combo box.

There are exceptions to this rule, so if you can explain why you really
need to store the Name as well as the ID, I can tell you how to do it.
 
Back
Top