oohmygod831
Registered User.
- Local time
- Today, 18:10
- Joined
- Feb 16, 2005
- Messages
- 43
i have a database that allows the user to book tools in or out of the stores. To keep a check on the bookings and to ensure that a tool isnt booked out when it isnt available i need to check the stock level of the tool being booked.
To do this i have a query that calculates the current stock level but i need to access this figure. i was directed towards using a DLookup.
The form i am using has cascading combo boxes which filter the tool selection down to the last combo box and the query results are based on the selection made in the last combo box.
However i am getting a runtime error 2001 and when i debug it points towards the DLookup. Any clues as to what is wrong with it?
The following code is in the AfterUpdate of the last combobox (cboToolName)
Dim bkValue As Integer
bkValue = DLookup("StockTotal", "qryCheck", "ToolID = " & Forms![frmBookInOut]!cboToolName)
If bkValue < 1 Then
MsgBox ("The tool is already booked out or hasn't been returned")
Cancel = True
Me.Undo
End If
To do this i have a query that calculates the current stock level but i need to access this figure. i was directed towards using a DLookup.
The form i am using has cascading combo boxes which filter the tool selection down to the last combo box and the query results are based on the selection made in the last combo box.
However i am getting a runtime error 2001 and when i debug it points towards the DLookup. Any clues as to what is wrong with it?
The following code is in the AfterUpdate of the last combobox (cboToolName)
Dim bkValue As Integer
bkValue = DLookup("StockTotal", "qryCheck", "ToolID = " & Forms![frmBookInOut]!cboToolName)
If bkValue < 1 Then
MsgBox ("The tool is already booked out or hasn't been returned")
Cancel = True
Me.Undo
End If