The CreateODBCDate function actually creates a date of now. What you want is
something like this:
<cfquery name="getcount" datasource="#Request.App.dsn#">
> SELECT *
> FROM tbl_downloads
> WHERE story = '#Form.story#'
> <cfif startdate IS NOT "">
> AND datedownloaded >= #DateFormat(Form.startdate)#
> </cfif>
> <cfif enddate IS NOT "">
> AND datedownloaded <= #DateFormat(Form.enddate)#
> </cfif>
> </cfquery>
----- Original Message -----
From: "Will Swain" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, September 05, 2001 9:35 AM
Subject: sorting within date range
> Hi,
>
> I want the user to be able to input a start and end date and then pull
> relevant records out of an Access db between those dates.
>
> The datatype in the db is Date/Time
>
> This is the query:
>
> <cfquery name="getcount" datasource="#Request.App.dsn#">
> SELECT *
> FROM tbl_downloads
> WHERE story = '#Form.story#'
> <cfif startdate IS NOT "">
> AND datedownloaded >= #CreateODBCDate(Form.startdate)#
> </cfif>
> <cfif enddate IS NOT "">
> AND datedownloaded <= #CreateODBCDate(Form.enddate)#
> </cfif>
> </cfquery>
>
> However, if I enter dates, they seem to be ignored, and the query just
pulls
> out all instances if I have only entered a start date and none if I enter
a
> start and an end date.
>
> Either way it's not working.
>
> Any suggestions?
>
> Cheers
>
>
> Will Swain
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists