VALUE APPEARING IN TEXT BOX ONCE COMBO BOX HAS UPDATED

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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)
 
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]
 
Back
Top