Background: Front End- MS Access 2010/VBA, Back End- MS SQL Server 2008
When I run the following code I get this error message: Run-time error '3464': Data type mismatch in criteria expression.
I put a Debug.Print strSQL statement in the code, copy the output and run it in SQL Studio Mgmt and it works. What am I doing wrong?
Select * FROM dbo_Activity WHERE ID_Projects= 3 AND DateTime='02/20/2015 11:25 AM';
When I run the following code I get this error message: Run-time error '3464': Data type mismatch in criteria expression.
I put a Debug.Print strSQL statement in the code, copy the output and run it in SQL Studio Mgmt and it works. What am I doing wrong?
Code:
strSQL = "Select * FROM dbo_Activity WHERE ID_Projects= " & CInt(Me.fIDProjects.Value) & " AND DateTime='" & Me.fDate2.Value & "';" Debug.Print strSQL Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
Select * FROM dbo_Activity WHERE ID_Projects= 3 AND DateTime='02/20/2015 11:25 AM';
Comment