Robert,
My bad. I forgot an important part: when you create the ODBC date, you gotta pass a
valid date. You can do it all in one pass like:
<CFSET startdate = "#CreateODBCdate(CreateDate(00,01,01))#">
<CFSET enddate = "#CreateODBCdate(CreateDate(01,01,01))#">
Yielding two valid ODBC dates --> {d '2000-01-01'} {d '2001-01-01'}
I used something like this in an app that ran against Access and it returned records
within the specified ranges.
Alec
> -----Original Message-----
> From: Robert Orlini [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 04, 2001 11:55 AM
> 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