We help IT Professionals succeed at work.

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?
Comment
Watch Question

I think MS Query likes text dates surrounded by pound/hash signs: #2015-03-09#
Top Expert 2013
Commented:
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 Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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.