Simple question I think

M

Michael Walsh

Fist things first I didn't create this situation and I'm
not even responsible to fix it, but the following
information would temporarilt fix this problem and would
help for suture considerations.

There is a form that populates a table. One of the fields
is a lookup. Here's the bad database design part. That
lookup should populate two different fields in the table,
1 - name and 2 - NameID. Anyway the database is little
too complicated and poorly designed to fix correctly, but
going forward I can solve the problem by making sure both
fields are captured instead of just the one.

The Name drop-down definitely contains the NameID, but it
only captures Name. I would like to add NameID as a field
and I would like to have it populated based on the
selection in the Name field.

Any help is greatly appreciated.
 
J

John Vinson

There is a form that populates a table. One of the fields
is a lookup. Here's the bad database design part. That
lookup should populate two different fields in the table,
1 - name and 2 - NameID. Anyway the database is little
too complicated and poorly designed to fix correctly, but
going forward I can solve the problem by making sure both
fields are captured instead of just the one.

You can "push" a second field from the combo into a (redundant,
unnecessary, and problematic - but you know that) bound control in the
Combo's AfterUpdate event. Invoke the Code Builder and put in code
like:

Private Sub cboName_AfterUpdate()
Me!txtNameID = cboName.Column(0)
End Sub

using, of course, your own field and control names. The Column()
property is zero based so (0) would be the first column, (1) the
second and so on.
 

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