Combo Box to Update Other Field Within Form

BruceFrey

Registered User.
Local time
Today, 09:57
Joined
Dec 12, 2002
Messages
20
Hello

I want to have a user pick a combo box on a form and once that supplier name is chosen - an after event procedure fills the contents of a field called account number, in the same form, based on the value in a table that corresponds to the supplier name they chose.

Here's what I have now for my after event which I know is incorrect.

Private Sub SupplierNumber_AfterUpdate()
' Update AccountNumber controls based on value selected in SupplierName combo box.
Me!AccountNumber = Me![AccountNumber]

End Sub

Thank you for any help you can provide.
 
You could just pick up the AC # as one of the fields in your data source that populates your Combo, then in the Control Source of your Text box put;
Code:
=ComboName.column([B]X[/B])
Were X is the column number that hold the data you want to display. Remember that in Combo Boxes and List Boxes the columns are numbered from Zero up. The first column (zero) is generally the bound column of the Combo/List Box and is often hidden. The column containing the data to be displayed in your text box can also be hidden if you want.

You will need no additional code to achieve this.
 
Here's an example that uses a list box.
 

Attachments

Hello

Thank you! Your suggestion worked great!
 

Users who are viewing this thread

Back
Top Bottom