简体   繁体   中英

Access Run Time Error 3464 data type mismatch in criteria expression

What is wrong with that code? I can't figure out why I keep getting this error.

Sub renttt()
Dim rent_list As Recordset
Dim query As String

query = "SELECT * FROM (Rent INNER JOIN Movies ON Rent.Movie_ID = Movies.ID) INNER JOIN Customers ON Rent.Customer_ID = Customers.ID WHERE Rent.Movie_ID = '" & txtbxmovieID.Value & "' AND Rent.Date_Returned is Null;"
Set rent_list = CurrentDb.OpenRecordset(query)

If rent_list.RecordCount = 1 Then
        rent_List.MoveFirst
        txtbxname.Value = (rent_list![CusName])
        txtbxsurname.Value = (rent_list![Surname])
        txtbxcardID.Value = (rent_list![Id_Card_number])
        txtbxaddress.Value = (rent_list![Address])
        txtbxrented.Value = (rent_list![Date_Rent])
End If


End Sub

Wouldn't MovieId be a numeric? If so, no quotes:

WHERE Rent.Movie_ID = " & txtbxmovieID.Value & " AND ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM