Hi!
I want to do a lookup on tblProduct before entering the price of the product in tblPurchaseProduct.
The names in my form are the same - Product_ID and Price.
I copied the code from Nortwind db, but an error occurs - red text (actually yellow).
Does anybody know, what could be the problem?
Tnx, mare
I want to do a lookup on tblProduct before entering the price of the product in tblPurchaseProduct.
Code:
tblPurchaseProduct ([u]PurhaseProduct_ID[/u], Purchase_ID, Product_ID, [b]Price[/b], Quantity, Cancel)
tblProduct ([u]Product_ID[/u], Name, [b]Price[/b])
The names in my form are the same - Product_ID and Price.
I copied the code from Nortwind db, but an error occurs - red text (actually yellow).
Code:
Private Sub Product_ID_AfterUpdate()
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "Product_ID = " & Me!Product_ID
' Look up product's unit price and assign it to UnitPrice control.
[COLOR=red]Me!Price = DLookup("Price", "tblProduct", strFilter)[/color]
Exit_Product_ID_AfterUpdate:
Exit Sub
End Sub
Does anybody know, what could be the problem?
Tnx, mare