Combo Box: Fill in 2 Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I created a combo box in a child table on a form that looks up the value of
[Payee_ID] in tblPayees and inserts it. When doing such both the [Payee_ID
and Payee] fields are displayed so I can see and know the value of the
Payee_ID selected. That works fine.

However, I prefer filling in BOTH the Payee_ID and Payee at the same time
using one combo box. Can I do that in Access 2003?

Yes I know that all I really need is the Payee_ID, but it's really nice to
see the Payee right next to it so I know that the correct payee was selected.

Thanks
 
Robert said:
Hello:

I created a combo box in a child table on a form that looks up the
value of [Payee_ID] in tblPayees and inserts it. When doing such both
the [Payee_ID and Payee] fields are displayed so I can see and know
the value of the Payee_ID selected. That works fine.

However, I prefer filling in BOTH the Payee_ID and Payee at the same
time using one combo box. Can I do that in Access 2003?

Yes I know that all I really need is the Payee_ID, but it's really
nice to see the Payee right next to it so I know that the correct
payee was selected.

Add a TextBox that displays the other column from the ComboBox. Set its
ControlSource to...

=ComboBoxName.Column(1)

(assumes the Payee is in the second column)
 
You can add code to the After Update event of the combo box like:

Me.txtPayee = Me.cboPayee_ID.Column(1)

The columns are numbered from 0.
 
Hello Duane:

At first I had a problem because I put the script in the After Update event
for the Payee field and nothing happened. However, I then moved it to the
After Update event of the [Payee_ID] field and it worked perfectly.

That was a very cool solution to the problem!

Thanks so much,
Robert
 
Back
Top