VALUE APPEARING IN TEXT BOX ONCE COMBO BOX HAS UPDATED

G

Guest

How do I get a value into a text box once I have selected some data from a
combo box.

For example: Select Customer Name from Combo Box, Customers Address to
appear in text box.

Any help would be much appreicated.

Regards

Graham
 
D

Douglas J. Steele

Assuming that the RowSource for the combo box includes Customer Address, you
can put code in the AfterUpdate event of the combo box:

Private Sub MyCombobox_AfterUpdate()

Me!txtAddress = Me!MyCombobox.Column(2)

End Sub

The above assumes that Address is the 3rd column of the combo box (the
Column collection starts numbering at 0)
 
J

John W. Vinson

How do I get a value into a text box once I have selected some data from a
combo box.

For example: Select Customer Name from Combo Box, Customers Address to
appear in text box.

Any help would be much appreicated.

Regards

Graham

Let's say that the customer combo box is named cboCustomerID, and that it's
based on a Query selecting the CustomerID (as the bound column), the customer
name (as the first displayed column), and the address:

SELECT CustomerID, LastName & ", " & FirstName AS CustomerName, AddressNo & "
" & Street & " " & City & " " & Postcode
FROM Customers
ORDER BY LastName, FirstName;

You can then put a textbox on the form with a Control Source

=cboCustomerID.Column(2)

to display the third column from the combo (it's a zero based index).

John W. Vinson [MVP]
 

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