Multi-column combo box

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a combo box with two columns; first one
for "ItemCode", second for "ItemDescription". When I used
the wizard to set up the combo box I first selected
the "ItemCode" field to store in the underlying table and
then tried again using "ItemDescription" to store data in
the underlying table. But only "ItemCode" (the first
column) is sent to the underlying table. Ultimately I
want to get data from both columns to populate two
seperate fields. I tried referencing the second column
using VBA but keep getting #NAME?.

This seems like one of those things that is so simple
that I can't see the forest for the trees. What am I
doing wrong?
 
As far as I know, you can only bind a combo box to one field. To do what
you want, you can:

1. Leave the combo box bound to your ItemCode field.

2. Put your ItemDescription field in a bound text box control on your form.

3. In the AfterUpdate event of the combo box, insert the following VBA
expression:

Me!ItemDescription = Me!MyComboBox.Column(1)

Of course, change "MyComboBox" to the name of the combo box on your form.
 

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

Back
Top