Skip to main content
Inspiring
January 14, 2009
Answered

Date woes

  • January 14, 2009
  • 3 replies
  • 677 views
I have a query that returns records when i do not use a where clause. I want to return records for a range of dates.
I have used between and >= and <= but no records are returned. The dates are stored in an msacess table as long dates. I tried with single quote both on and off the dates - the code follows - thanks

jim
and btw the search on these forums returns an error message. anyone else have the same results?
This topic has been closed for replies.
Correct answer Newsgroup_User
rockhiker wrote:
> where startDate >= Date() and startDate <= 2009-31-101

WHERE startDate >= <cfqueryParam value="#now()#"
cfsqltype="cf_sql_date"> AND startDate <= <cfqueryParam
value="2009-31-10" cfsqltype="cf_sql_date">

3 replies

Inspiring
January 14, 2009
Assuming startdate is a date datatype, try this:

date1 = createdate(something);
date2 = createdate(something);

select *
from crabcalendar
where startdate >= #date1#
and startdate < #date2#

Once you know it's working, put those variables into cfqueryparam tags.
Inspiring
January 14, 2009
PaulH **AdobeCommunityExpert** wrote:
> rockhiker wrote:
>> I have used between and >= and <= but no records are returned. The
>> dates are stored in an msacess table as long dates. I tried with
>> single quote both on and off the dates - the code follows - thanks
>
> turn those strings into dates that access can handle either via
> createdate() or createODBCdate() functions.
>

Or, best yet, <cfqueryparam...> tags with cfsqltype="cf_sql_date"
parameters.

Inspiring
January 14, 2009
rockhiker wrote:
> I have used between and >= and <= but no records are returned. The dates are
> stored in an msacess table as long dates. I tried with single quote both on and
> off the dates - the code follows - thanks

turn those strings into dates that access can handle either via createdate() or
createODBCdate() functions.

rockhikerAuthor
Inspiring
January 14, 2009
i added the following code and get a data type mismatch error. tried with/without quotes - thks