Update my Text Box please

G

Guest

I have a combo box and two text boxes (in Form)
The combo box and the two text boxes are independent of each other

Mission: when i change the combo box, i want the two text boxes changes
according to my selection in the combo box

The source in the combo box is same as the source of text boxes
But the text boxes have different table which bound them

Take a look:

Table ==> Customer Details
Field = Customer Name (source for invoice Customer Name combo box)
= Address
= Country

Table ==> Invoice
Field (form view) = Customer Name (combo box)
= Address (text box)
= Country (text box)

Focus : when i change the Customer Name (combo box), i want the address and
country text boxes to change automatically.

The condition is:
Value in these text boxes (Invoice Table) must be the same as the table
Customer Details' address and country

Reminder : Please do not tell me to refer to Northwind or try combo box
wizard because i have already tried and failed. My Invoice page is main page
and i cannot afford to redo everything cause this take months to redo.
 
T

tina

base the CustomerName combobox's RowSource on tblCustomerDetails, as

SELECT [Customer Name], [Address], [Country] FROM [Customer Details] ORDER
BY [Customer Name];

set the following properties of the combo box, as

ColumnCount: 3
ColumnWidths: 2"; 0"; 0"
(note: only the Customer Name will show in the droplist in form view. adjust
the 2" inches width if you need more or less space to show the names.)
BoundColumn: 1

add the following code to the combobox's AfterUpdate event procedure, as

Private Sub MyComboBox_AfterUpdate()

If Not IsNull(Me!MyComboBox) Then
Me!AddressTextBox = Me!MyComboBox.Column(1)
Me!CountryTextBox = Me!MyComboBox.Column(2)
End If

End Sub

substitute the correct names of Customer Name combo box, Address text box,
and Country text box, of course.

hth
 
G

Guest

Thanks Tina.
You are totally and absolutely great
You solved my problems that i had consume days for these and that really
works
 

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