Hi folks,
I am sure this really simple but I just can't seem to find what is wrong here.
The following code is creating an error 13 message. Strangely though, variables MyLatestDate and StockItem are returning the correct values. It is only the Dlookup where I am struggling.
Would appreciate any assistance.
Many thanks
David
I am sure this really simple but I just can't seem to find what is wrong here.
The following code is creating an error 13 message. Strangely though, variables MyLatestDate and StockItem are returning the correct values. It is only the Dlookup where I am struggling.
Code:
Private Sub StockItem_AfterUpdate()
Dim MyLatestDate As Date
Dim StockItem As String
Dim StockNo As Integer
StockItem = Me.StockItem
MyLatestDate = DLookup("MaxofDateAdded", "QryLatestDateStockAdded", "MaxofDateAdded = #" _
& DMax("MaxofDateAdded", "QryLatestDateStockAdded") & "#")
StockNo = DLookup("StockNumber", "tblStock", "StockItem =" & "'" & [StockItem] & "'" _
And "[Dateadded]= #" & [MyLatestDate] & "#")
End Sub
Would appreciate any assistance.
Many thanks
David