S
shannaj via AccessMonster.com
I have now refined by database to reflect my price levels. I have a
pricelevel table. I have my item list linked by pricelevels, and I have my
customertable linked by Pricelevels. Now I can not figure out how to get
them to look up the correct price in my subform. I know I am doing something
wrong but I can not figure it out. I was using this on my old subform and it
worked great but now that my primary key is an autonumber instead of the
itemid, it is not working properly. I am just not getting the whole Dlookup
function. Here is what was on my old subform. Any one have any ideas? I am
just not sure how to incorporate the pricelevels and customer tables.
rivate 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)
' 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!ItemDescription = DLookup("ItemDescription", "tblItemList", strFilter)
Exit_ItemID_AfterUpdate:
Exit Sub
Err_ItemID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ItemID_AfterUpdate
pricelevel table. I have my item list linked by pricelevels, and I have my
customertable linked by Pricelevels. Now I can not figure out how to get
them to look up the correct price in my subform. I know I am doing something
wrong but I can not figure it out. I was using this on my old subform and it
worked great but now that my primary key is an autonumber instead of the
itemid, it is not working properly. I am just not getting the whole Dlookup
function. Here is what was on my old subform. Any one have any ideas? I am
just not sure how to incorporate the pricelevels and customer tables.
rivate 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)
' 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!ItemDescription = DLookup("ItemDescription", "tblItemList", strFilter)
Exit_ItemID_AfterUpdate:
Exit Sub
Err_ItemID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ItemID_AfterUpdate