Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


My WHERE clause is not filtering dates properly

Posted on 2010-01-08
Medium Priority
Last Modified: 2012-05-08
I have a query I am building that needs a WHERE clause to filter dates. It does not seem to be working, and I cannot understand why. Can someone please tell me what I am doiing wrong.

Below is the code of the Query and then the rsults, which shows two values that I believe should be filtered out.
SELECT DAFifteenthStPanelFPY.WeekEndingDate, DAFifteenthStPanelFPY.SumOfInspected
FROM DAFifteenthStPanelFPY
WHERE DAFifteenthStPanelFPY.WeekEndingDate > 4/01/2008
ORDER BY DAFifteenthStPanelFPY.WeekEndingDate;

Open in new window

Question by:Rex85
  • 3
  • 2
LVL 93

Accepted Solution

Patrick Matthews earned 2000 total points
ID: 26212842
You have to qualify your dates:

SELECT DAFifteenthStPanelFPY.WeekEndingDate, DAFifteenthStPanelFPY.SumOfInspected
FROM DAFifteenthStPanelFPY
WHERE DAFifteenthStPanelFPY.WeekEndingDate > #4/01/2008#
ORDER BY DAFifteenthStPanelFPY.WeekEndingDate;

Author Comment

ID: 26212882
That worked. Thank you. Can you tell me what that means though?

Author Closing Comment

ID: 31674722
Thank you very much.

LVL 93

Expert Comment

by:Patrick Matthews
ID: 26212942
Access and VBA both use the # symbol to qualify dates; without it, they will interpret 4/1/2008 as:

"4 divided by 1 divided by 2008"

Author Comment

ID: 26213013
Ah...Thank you very much. I tried quotes, but that made it think it was text of course. Thanks again.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Among the most obnoxious of Exchange errors is error 1216 – Attached Database Mismatch error of the Jet Database Engine. When faced with this error, users may have to suffer from mailbox inaccessibility and in worst situations, permanent data loss.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question