error 3464 'data type mismatch in criteria express
Hi,
I have a from that tells me the next error when I try to run the code of the only action button on the form:
Data type mismatch in criteria expression (error number 3464)
The code that the button runs on to is:
Private Sub cmdCheckOut_Click()
On Error GoTo Err_cmdCheckOut_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim sSQL As String
Dim intNumber As Long
Dim varItem As Variant
If Me.lstCheckOut.ItemsSelected.Count = 0 Then
MsgBox "Er werd geen keuze gemaakt uit de lijst." & vbCrLf & _
"Er werd dus niemand uitgeschreven." & vbCrLf & vbCrLf & _
"Aucun choix n'a été effectué." & vbCrLf & _
"Personne n'a donc été désinscrit.", vbExclamation, "CobelAdmin"
Exit Sub
Else
For Each varItem In Me.lstCheckOut.ItemsSelected
intNumber = Me.lstCheckOut.Column(0)
sSQL = "SELECT tblOpvolgingBezoekers.Autonumber, tblOpvolgingBezoekers.DateTimeOut, tblOpvolgingBezoekers.CheckOutDoor " & _
"FROM tblOpvolgingBezoekers " & _
"WHERE (((tblOpvolgingBezoekers.Autonumber)= " & Chr(34) & intNumber & Chr(34) & "));"
Set db = Application.CurrentDb()
Set rst = db.OpenRecordset(sSQL, dbOpenDynaset)
While Not rst.EOF
rst.Edit
rst("DateTimeOut") = Now()
rst("CheckOutDoor") = sAanlog
rst.Update
rst.MoveNext
Wend
rst.Close
Set rst = Nothing
Set db = Nothing
Next varItem
End If
Exit_cmdCheckOut_Click:
Exit Sub
Err_cmdCheckOut_Click:
MsgBox Err.Description & " Error number = " & Err.Number
Resume Exit_cmdCheckOut_Click
End Sub
Does anyone know why I get this error? To me the code seems OK...
|