Output
#CreateODBCDate(Form.startdate)# and #CreateODBCDate(Form.enddate)#
before the CFQUERY to see what's going in the SQL.

Sounds like #CreateODBCDate(Form.startdate)# is being translated to a date
which is early than all records in the database.  Thus, returning all
records.

and #CreateODBCDate(Form.enddate)# is being translated to the same date
which makes the SQL return all records between two same date/time.  Which
obviously will return no records unless you have a record that's right on
#CreateODBCDate(Form.startdate)# and #CreateODBCDate(Form.enddate)#

Not exactly a solution to your problem....but just some place to start
debugging.

Billy


-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]]
Sent: September 5, 2001 10:36 AM
To: CF-Talk
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

Reply via email to