Lookup column

J

Joe

Hello Everyone,

I have a lookup column in my database with two parts. One part lists the
supplier's name with the supplier's ID number directly accross in the other
part. i enter data via a form. What I would like to do is select the supplier
field on the form but have the supplier's ID number auto populate in another
field on the form. Is this possible or am I going about this the wrong way?

Thanks.
 
B

Beetle

If by "lookup column" you mean a combo box, and if both the supplier name and
supplier ID appear in the combo box list, then you can use the column method
to accomplish what you want.

Add an unbound textbox to your form, then in the
AfterUdate event of your combo box put;

Me.NameOfYourUnboundTextbox = Me.NameOfYourComboBox.Column(x)

where x is the number of the column that contains the supplier ID. It's a
zero based numbering system so Column(0) is the first column, Column(1) is
the second column, etc.

HTH
 
J

Jeanette Cunningham

Joe,
You wouldn't usually need the SupplierID to populate another control on the
form.
Usually the combo with the Supplier has 2 columns. One of the columns is
hidden from the user - the SupplierID.
So the form already knows the SupplierID once a user selects a supplier.
If you want to catch the SupplierID to feed it back to the table, the combo
needs to have its datasource set to the field SupplierID and the SupplierID
will automatically go into the table. However if the combo is just an
unbound lookup to set the form to the Supplier's details, then don't do
this.

Jeanette Cunningham
 
J

Joe

Thanks again, Jeanette. I appreciate the information and shall act on it.
Hopefully, you won't see another post from me about the same subject.

Joe
 

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

Top