By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,963 Members | 1,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,963 IT Pros & Developers. It's quick & easy.

Access Date comparison Problem

P: 63
Hi I am trying to use the following query to get all dates in a particular range please let me know wht I am doing wrong

Expand|Select|Wrap|Line Numbers
  1. SELECT Unique_Sets_Bulk.CustomerNo, Unique_Sets_Bulk.OrderDate, Unique_Sets_Bulk.RouteNo
  2. FROM Unique_Sets_Bulk
  3. WHERE (((CDate([OrderDate]))>="#1/1/2005#" And (CDate([OrderDate]))<="#12/1/2009#"));
  4.  
  5.  
Jan 23 '08 #1
Share this Question
Share on Google+
4 Replies


Delerna
Expert 100+
P: 1,134
Nothing obvious stands out
Try putting the CDate(orderDate) into your select fieldlist and see
that it is in the correct format for the comparison to work
Jan 23 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
WHERE (((CDate([OrderDate]))>="#1/1/2005#" And (CDate([OrderDate]))<="#12/1/2009#"));

I think you need to lose the quotation marks around the dates, they're turning your dates into strings. Date literals are delimited by the pound sign alone.

Linq ;0)>
Jan 23 '08 #3

ADezii
Expert 5K+
P: 8,679
Hi I am trying to use the following query to get all dates in a particular range please let me know wht I am doing wrong

Expand|Select|Wrap|Line Numbers
  1. SELECT Unique_Sets_Bulk.CustomerNo, Unique_Sets_Bulk.OrderDate, Unique_Sets_Bulk.RouteNo
  2. FROM Unique_Sets_Bulk
  3. WHERE (((CDate([OrderDate]))>="#1/1/2005#" And (CDate([OrderDate]))<="#12/1/2009#"));
  4.  
  5.  
Expand|Select|Wrap|Line Numbers
  1. SELECT Unique_Sets_Bulk.CustomerNo, Unique_Sets_Bulk.OrderDate, Unique_Sets_Bulk.RouteNo, CDate([OrderDate]) AS Converted_Date
  2. FROM Unique_Sets_Bulk
  3. WHERE CDate([OrderDate])>=#1/1/2005# And CDate([OrderDate])<=#12/1/2009#;
Jan 23 '08 #4

P: 63
Yup It works ... thanx a lot
Jan 23 '08 #5

Post your reply

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