Forms: Products, Customers, Invoice,
Subform: Invoice Details.
Customers are categorized as Wholesale, Retail, & Distributor
Products have three price levels. Wholesale, Retail & Distributor.
In the main form Invoice, I have a combo lookup of CustomerID with a price level column.
In the Subform on the After Update of ProductID Combo I have:
Private Sub ProductID_AfterUpdate()
On Error GoTo Err_ProductID_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ProductID = " & Me!ProductID
' Look up Item's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("RetailPrice", "Product Line", strFilter)
Me!ProductID = DLookup("ProductID", "Product Line", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
End Sub
How would I alter this so that, upon selecting customer in main form. The subform unit price will equal the price level indicated by the customer?
If the Customer ID equals wholesale then UnitPrice equals wholesale price of product column.
I have been copying, pasting and basically modifying but I don't know how to write this code. I can't seem to find examples either.
Thanks in advance.
Mary
Subform: Invoice Details.
Customers are categorized as Wholesale, Retail, & Distributor
Products have three price levels. Wholesale, Retail & Distributor.
In the main form Invoice, I have a combo lookup of CustomerID with a price level column.
In the Subform on the After Update of ProductID Combo I have:
Private Sub ProductID_AfterUpdate()
On Error GoTo Err_ProductID_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ProductID = " & Me!ProductID
' Look up Item's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("RetailPrice", "Product Line", strFilter)
Me!ProductID = DLookup("ProductID", "Product Line", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
End Sub
How would I alter this so that, upon selecting customer in main form. The subform unit price will equal the price level indicated by the customer?
If the Customer ID equals wholesale then UnitPrice equals wholesale price of product column.
I have been copying, pasting and basically modifying but I don't know how to write this code. I can't seem to find examples either.
Thanks in advance.
Mary