cstanley
05-20-2002, 09:32 AM
Hello all - I have two fields in a table - one for a number (PK) and an associated name with the number. My combo box looks up the number, but, in a form, I want a separate text field to be linked so, when the number is selected from the combo box, it displays the assocated name in the text field. How do I do this?
Thanks!
Chris
RichMorrison
05-20-2002, 09:42 AM
The simplest way is make a query that selects the PK number and the associated name. Create a 2-column list box based on this query.
If you want the users to see the number and the text, define sufficient space for each field. If you wish to hide the PK number, make the field width zero.
If you really truly want the associated name in a separate text box, then:
make a combo box instead of a list box,
make an event procedure on the combo box "After Update". Copy Column(1) - it's really column 2 - to your text box and Repaint the form.
RichM
[This message has been edited by RichMorrison (edited 05-20-2002).]
cstanley
05-20-2002, 10:44 AM
Any example code for the AfterUpdate way?
Thanks!
Chris
Jack Cowley
05-20-2002, 10:54 AM
Me![MyField] = Me![MyComboBox].Column(1)
Hope it was OK to hop in here Rich...
[This message has been edited by Jack Cowley (edited 05-20-2002).]