473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Query Problem

102 64KB
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?

Expand|Select|Wrap|Line Numbers
  1. strSQL = "Select * FROM dbo_Activity WHERE ID_Projects=  " & CInt(Me.fIDProjects.Value) & "  AND  DateTime='" & Me.fDate2.Value & "';"
  2. Debug.Print strSQL
  3. Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)

Select * FROM dbo_Activity WHERE ID_Projects= 3 AND DateTime='02/20/2015 11:25 AM';
Mar 5 '15 #1

✓ answered by Seth Schrock

Date/time values must be surrounded by the pound symbol (#), not single quotes.

1 926
Seth Schrock
2,965 Expert 2GB
Date/time values must be surrounded by the pound symbol (#), not single quotes.
Mar 5 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Dave | last post by:
Hi all, I've been trying to figure this out for the last day and a half and it has me stumped. I've got a web application that I wrote that keeps track of trading cards I own, and I'm moving it...
6
by: John Baker | last post by:
Hi: As those who have looked at this newsgroup recently will realize, I am a neophyte with Access, although I have experienced with Approach (the Lotus product). There are things I could easily...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
2
by: Bernd Hohmann | last post by:
Dear collegues, small query problem. A table (simplified example)... customer as char(5) inv_date as date amount as double
3
by: luis.c.torres | last post by:
Hello. I have and unbound form with a subform. The form has 4 controls (a combo, two txt boxes and a button). The combo has the filter criteria (Equal to, newer than, older than and between)...
1
by: hardik | last post by:
hi friends i need help in this sql query i have table like, id fid __ _____ autonumber text and i am storing values like
29
by: wizofaus | last post by:
I previously posted about a problem where it seemed that changing the case of the word "BY" in a SELECT query was causing it to run much much faster. Now I've hit the same thing again, where...
8
by: Philip_collins | last post by:
Hi! the following sql is identical to code in another database of mine. in the first database it works perfectly, that is to say it writes the query and I have a form based on the query. in the...
4
trueadvantage
by: trueadvantage | last post by:
Hi... I have 1 little but critical (for me) problem regarding access query. Problem Details: - I have one table which includes Employee Name and Employee ID Table:- EmpName EmpID A ...
2
Claus Mygind
by: Claus Mygind | last post by:
I am have a problem with a query that does not return a rowset. select t1.*, t2.name, t2.addr1, t2.addr2, t2.city, t2.st, t2.zip, t2.phone, t2.fax from contact t1 left join master t2 on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.