D
Dan
I have a inventory database with tables for items and item sales.
tblitems
itemsID
item
Iprice
active y/n
tblitemsales
itemsalesID
itemsID
Sprice
tax
I have a subform to enter the item sales with a combo box for ItemID which
pulls the item price from the items table. how do I get this to update in
the sales price? I have looked to the northwinds afterupdate code for
productID but do not understand how it works. I have limited VB knowledge.
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 product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
End Sub
tblitems
itemsID
item
Iprice
active y/n
tblitemsales
itemsalesID
itemsID
Sprice
tax
I have a subform to enter the item sales with a combo box for ItemID which
pulls the item price from the items table. how do I get this to update in
the sales price? I have looked to the northwinds afterupdate code for
productID but do not understand how it works. I have limited VB knowledge.
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 product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
End Sub