Give this one a try,

<CFSET startdate = "#Createdate(Year,Month,Day)#">
<CFSET enddate = "#Createdate(Year2,Month2,Day2)#">
<cfset startdate = #dateformat(startdate,'mm/dd/yyyy')#>
<cfset enddate = #dateformat(enddate,'mm/dd/yyyy')#>
<cfquery query="myQuery" Datasource="MyDataSource">
Select * 
>From My Table 
where OrderDate >= '#CreateODBCDateTime(startdate+TimeFormat("00:00:00"))#' 
  and OrderDate <= '#CreateODBCDateTime(enddate+TimeFormat("23:59:00"))#'
</cfquery>



-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 4:55 PM
To: CF-Talk
Subject: RE: date range search


Thanks for the suggestion. It didn't work though. I have a form with a
dropdown menu. Can dates in an Access table between: 01/01/00 and 01/01/01
be searched ?
-------------------------------------
Using my code:
<CFSET startdate = "#Createdate(Year,Month,Day)#">
<CFSET enddate = "#Createdate(Year2,Month2,Day2)#">
<cfset startdate = #dateformat(startdate,'mm/dd/yy')#>
<cfset enddate = #dateformat(enddate,'mm/dd/yy')#>

<CFQUERY name="getwweb" datasource="wwebsales">
SELECT * FROM wwebsales
where orderdate between #startdate# and #enddate#
</cfquery>
-----------------------------------
I can the following error:

ODBC Error Code = 22012 (Division by zero)
[Microsoft][ODBC Microsoft Access Driver]Division by zero (null)
SQL = "SELECT * FROM wwebsales where orderdate between 01/01/00 and
01/01/01"
Data Source = "wwebsales"
----------------------------------

Thanks.

Robert O.

>-----Original Message-----
>From: Lamon, Alec [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, April 03, 2001 3:04 PM
>To: CF-Talk
>Subject: RE: date range search
>
>
>I think you want to use the CreateODBCDate() function to create
>your start and end dates.
><CFSET startdate = "#CreateODBCdate(Year,Month,Day)#">
><CFSET enddate = "#CreateODBCdate(Year2,Month2,Day2)#">
>
>Then refer to those in your query *without* 's. (the
>CreateODBCDate() function puts them in for you):
>
>
><CFQUERY name="getwweb" datasource="wwebsales">
>SELECT * FROM wwebsales
>where orderdate between #startdate# and #enddate#
></cfquery>
>
>> -----Original Message-----
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to