That was because your dates were in the incorrect format.
Try:
<CFSET startdate = Createdate(Year,Month,Day)>
<CFSET enddate = Createdate(Year2,Month2,Day2)>

<CFQUERY name="getwweb" datasource="wwebsales">
SELECT * FROM wwebsales
where orderdate between #startdate# and #enddate#
</cfquery>

> 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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to