Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Yes/No checkbox behind the scenes

Status
Not open for further replies.

evansc

Technical User
Joined
Jul 19, 2004
Messages
42
Location
US
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

 
You've declared myItCopy as Integer. If [copy] is numeric, remove the single quotes:

[tt]... & myItNum & " AND [Copy] = " & myItCopy[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top