Microsoft Query Error: Illegal Data: '{ts '2015-'. Expected Format: 'Default Datetime Mask'

I am creating an ODBC query in Excel 2003 (I know, old). When put in a parameter for a date, I get an error that says: Microsoft Query Error: Illegal Data: '{ts '2015-'. Expected Format: 'Default Datetime Mask' . When I look at the data without parameters, the date is in this format: YYYY-MM-DD. I have tried YYYY-MM-DD, YYYY-MM-DD HH:MM:SS and other variations of YYYY MM DD. Nothing is working. I get the same error every time. Any ideas?
Who is Participating?
I think MS Query likes text dates surrounded by pound/hash signs: #2015-03-09#
when you use date literals in ODBC you need to use this syntax:
select * from Table1 where datecolumn > {d '2014-12-30'}      -- YYYY-MM-DD
select * from Table1 where datecolumn > {ts '2014-12-30 22:35:56'}      -- YYYY-MM-DD HH:MM:SS (HH should be in 24 hour format)

Open in new window

Please note that the {} should not be included into the apostrophes, only the date literal should. Here is the source from MSDN
Martin LissOlder than dirtCommented:
I've requested that this question be closed as follows:

Accepted answer: 250 points for ThomasMcA2's comment #a40655273
Assisted answer: 250 points for chaau's comment #a40655276

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.