Mismatched Data Type in an Expression

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
 
D

Douglas J. Steele

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top