Mismatched Data Type in an Expression

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Below is a sub I am using to compare two request counters
so I can update the one table. I keep getting an error
message on the SQL statement that says the data type is
mismatched. All of the data types in the table are ong
Integer as the length and the format as Fixed.

I cannot seem to pinpoint what is wrong. Any help is
appreciated.

-Chris



Private Sub Requested_Docs_Received_Click()
Dim M As Recordset, D As Database, C As Recordset
Set D = CurrentDb

If [Requested_Docs_Received] = True Then
Me![Missing_Docs] = False
V = [Forms]![frmMain].[Request_Counter]
Set M = D.OpenRecordset("Select [Missing_Docs_Received]
From [tblMissing] Where [Request_Counter] = '" & V & "';",
dbOpenSnapshot)
M![Missing_Docs_Received] = True
M.Update
End If
 
Your WHERE clause is assuming that [Request_Counter] is text.

If it's Long Integer (as your post says), get rid of the quotes:

[Request_Counter] = " & V

(the semi-colon isn't necessary, by the way)
 
Back
Top