Display related field based on combo box


Jim Diroff

I am a new user. I have a form based on a table with two fields. One field is
Part Number, the other Part Name. On the form, the user looks up the Part
Number in a combo box and selects the appropriate choice. What I am trying to
do is to populate a text box with the Part Name that corresponds to the Part
Number selected in the combo box. It seems so easy and I have been all over
it with AfterUpdate code and such but I can not seem to get it to work. I
could use a point in the right direction. Thanks.


One option would be to take advantage of the Column property
of the combo box. You would add the PartName field to the
Row Source of your combo box, so the combo box properties
might look like;

Control Source: PartNumber
Row Source Type: Table/Query
Row Source: Select PartNumber, PartName From tblParts
Order By PartNumber
Column Count: 2
Column Widths: 1", 0"
Bound Column: 1

Then you would have a text box on your form with a Control Source
like the following (assuming the combo box is named cboPartNumber);


The columns in a combo box use a zero based index, so the first column
is Column(0), the second is Column(1), etc.

Note: If you are using a continuous form, and the combo box you are referring
to is in the detail section of the form, this will not give the
expected results.
If that is the case, post back.

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