S
shannaj via AccessMonster.com
I have an order entry form with the following in code for AfterUpdate on my
ItemID. I copied it from the northwind sample database. What I am trying to
accomplish is when the Item Id is entered, I want it to pull the price from
the Items table, but if the price is changed, I want it to be reflected in
the Itemdetails table. The form I am using is created from a query, just
like the northwind database. The problem I am having is that when I run this,
I am getting the following message: Syntax error (missing operator) in query
expression 'ItemID=BMD 1002-01' Can someone please shed some light in to
what I am doing wrong?
Private Sub ItemID_AfterUpdate()
On Error GoTo Err_ItemID_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ItemID = " & Me!ItemID
' Look up product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "tblItemList", strFilter)
Exit_ItemID_AfterUpdate:
Exit Sub
Err_ItemID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ItemID_AfterUpdate
ItemID. I copied it from the northwind sample database. What I am trying to
accomplish is when the Item Id is entered, I want it to pull the price from
the Items table, but if the price is changed, I want it to be reflected in
the Itemdetails table. The form I am using is created from a query, just
like the northwind database. The problem I am having is that when I run this,
I am getting the following message: Syntax error (missing operator) in query
expression 'ItemID=BMD 1002-01' Can someone please shed some light in to
what I am doing wrong?
Private Sub ItemID_AfterUpdate()
On Error GoTo Err_ItemID_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ItemID = " & Me!ItemID
' Look up product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "tblItemList", strFilter)
Exit_ItemID_AfterUpdate:
Exit Sub
Err_ItemID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ItemID_AfterUpdate