|
-
January 4th, 2013, 06:25 PM
#6
Re: Resolved - SQL Statement for Selecting Date Range
 Originally Posted by George1111
I have a TEXT field which contains a Date in a Table in an ACCESS Database
I want to select records from the table using an SQL Statement
Code:
eg, Select * from Table where DateField between #01/01/2004# and #31/07/2004#
The problem is that the DateField is treated as a text literal rather than a date, so in reality, every date on file is selected
Is there a trick to make the SQL Statement understand that the text field is in fact a date field and therefore do a date comparison rather than a text comparison ?
eg, Is there a way I can invert the text field (withing the SQL Statement) so I am comparing with a value like 20040525
RESOLUTION
You need to add the cdate function to the string
Code:
eg, Select * from Table where cdate(DateField) between #01/01/2004# and #31/07/2004#
Thanks
Thank It has helped me .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|