Hi All
I've been wrestling with this for a while. I have tried many variations of the below code. Basically, I have a combo box for ItemReferenceNumber and I want it to bring up the price as allocated in tblProducts:
Private Sub ItemReferenceNumber_AfterUpdate()
Dim strFilter As String
strFilter = "ItemReferenceNumber = " & Me!ItemReferenceNumber & "'"
Me!ItemUnitPrice = DLookup("Price", "tblProducts", strFilter)
End Sub
I either get 'Run time error 3075 Syntax eror in string in query expression with the above code' or 'run time error 2001 you have cancelled the previous operation' for the below code:
Private Sub ItemReferenceNumber_AfterUpdate()
Dim strFilter As String
strFilter = "ItemReferenceNumber = " & Me!ItemReferenceNumber
Me!ItemUnitPrice = DLookup("Price", "tblProducts", strFilter)
End Sub
ItemReferenceNumber is text and is the PK for tblProducts
Any suggestions gratefully received
Katy
I've been wrestling with this for a while. I have tried many variations of the below code. Basically, I have a combo box for ItemReferenceNumber and I want it to bring up the price as allocated in tblProducts:
Private Sub ItemReferenceNumber_AfterUpdate()
Dim strFilter As String
strFilter = "ItemReferenceNumber = " & Me!ItemReferenceNumber & "'"
Me!ItemUnitPrice = DLookup("Price", "tblProducts", strFilter)
End Sub
I either get 'Run time error 3075 Syntax eror in string in query expression with the above code' or 'run time error 2001 you have cancelled the previous operation' for the below code:
Private Sub ItemReferenceNumber_AfterUpdate()
Dim strFilter As String
strFilter = "ItemReferenceNumber = " & Me!ItemReferenceNumber
Me!ItemUnitPrice = DLookup("Price", "tblProducts", strFilter)
End Sub
ItemReferenceNumber is text and is the PK for tblProducts
Any suggestions gratefully received
Katy