March 25th, 2007, 09:46 AM
Resolved - SQL Statement for Selecting Date Range
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
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
eg, Select * from Table where DateField between #01/01/2004# and #31/07/2004#
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
You need to add the cdate function to the string
eg, Select * from Table where cdate(DateField) between #01/01/2004# and #31/07/2004#
Last edited by George1111; March 25th, 2007 at 09:59 AM.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!