Lookup a value

KEKeogh

Registered User.
Local time
Yesterday, 20:00
Joined
May 4, 2011
Messages
80
I'm very new to building forms and reports in Access 2000 and need some help with something I know should be easily accomplished.

I have a combo box that I can select a [Driver #] from based on the the [Drivers] table.

What I want is a text box to automatically populate with the [Last Name] from that same [Drivers] table.

So basically if I select Driver # "701" in the combo box I want the text box to populate with the name "Smith" that is found in the corresponding record of the [Drivers] table for number 701.

I know it probably simple but everything I've tried doesn't seem to work.

Thanks
Kathie
 
Welcome to the forum!

The easiest way to accomplish what you want is to make sure that you bring the name as well as the driver # in the combo box. Then you can add a separate, unbound textbox control to your form and assign the name to that textbox using the following expression in the textbox's control source

=comboboxname.column(x)

Where x= the column number that corresponds to the driver's name. Just a little note, Access starts numbering at column zero not one.

So, if the row source of the combo box looks like this:

SELECT [driver#], drivername FROM...., to display the driver's name, the expression would look like this:

=comboboxname.column(1)

You will have to substitute the actual name of your combo box in the expression in place of "comboboxname".
 
Thanks!

=comboboxname.column(x)

This is what finally worked.
 
You're welcome; glad it worked out for you.
 

Users who are viewing this thread

Back
Top Bottom