Auto Populate field

jmriddic

Registered User.
Local time
Today, 06:21
Joined
Sep 18, 2001
Messages
150
In the database I am working on in a college course for a project with we have many tables like Employees,Products, Sales, and Sale Line Item. One of the requirements was to create a form that had the Sale information(which I did lookups to other table fields to allow them to populate the Employee and Customer ID fields for the Sale table fields of the same nature) and the Line Item info(which was a subform). On the sub form I created a lookup to the Product ID field to populate its Item Product ID. There is also a field on there for Item Unit Price. What I would like it to do is when I select the Product ID from the lookup to autopopulate the field for Item Unit Price referecing the Product Unit Price. Is there a way to do that?
 
The simple way would be to include the Item Unit Price in the Combobox you're using for looking up the Item Product ID and assigning it in the Combobox AfterUpdate event.

Set up your Combobox using the wizard and include the fields you need, from Left-to-Right.

If, in the Combobox, they appear as

Item Product ID, Item Unit Price

the code would be

Code:
Private Sub YourComboBoxName_AfterUpdate()
   Me.[Item Unit Price] =  Me.YourComboBoxName.Column(1)
End Sub

Notice that the column index is zero based, so the second item in the Combobox has an Index Value of 1.

Linq ;0)>
 
Thanks will try
 

Users who are viewing this thread

Back
Top Bottom