I have a library DB. I track what items we have, whether or not they are on the shelves, and whose borrowing, etc.
When I record that a video has been loaned out in one form, it accesses the table that tracks whether or not things are on the shelf and it unchecks accordingly.
I'm working on a different DB with the same type of issue. For some reason, I'm getting told "Datatype Mismatch in Criteria Expression." What I go to debug, it tells me the problem is in the very last line: "DoCmd.RunSQL mySQL" Any ideas? This is my code.
Private Sub Copy_Exit(Cancel As Integer)
Dim myItNum As Integer
Dim myItCopy As Integer
Dim mySQL
DoCmd.SetWarnings (WarningsOff)
myItNum = Me.[ItemID]
myItCopy = Me.[Copy]
mySQL = "UPDATE [CopyAvailability] SET [OnShelf] = 0 WHERE [ItemID] = " & myItNum & " AND [Copy] = '" & myItCopy & "'"
DoCmd.RunSQL mySQL
DoCmd.SetWarnings (WarningsOn)
End Sub
When I record that a video has been loaned out in one form, it accesses the table that tracks whether or not things are on the shelf and it unchecks accordingly.
I'm working on a different DB with the same type of issue. For some reason, I'm getting told "Datatype Mismatch in Criteria Expression." What I go to debug, it tells me the problem is in the very last line: "DoCmd.RunSQL mySQL" Any ideas? This is my code.
Private Sub Copy_Exit(Cancel As Integer)
Dim myItNum As Integer
Dim myItCopy As Integer
Dim mySQL
DoCmd.SetWarnings (WarningsOff)
myItNum = Me.[ItemID]
myItCopy = Me.[Copy]
mySQL = "UPDATE [CopyAvailability] SET [OnShelf] = 0 WHERE [ItemID] = " & myItNum & " AND [Copy] = '" & myItCopy & "'"
DoCmd.RunSQL mySQL
DoCmd.SetWarnings (WarningsOn)
End Sub