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-----
> From: Robert Orlini [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 03, 2001 4:30 PM
> To: CF-Talk
> Subject: date range search
>
>
> I'm working on a search form which can search between a range
> of dates. I'm
> using the code below and searching a orderdate column with the dates
> converted to 00/00/00 format and specified as Date/Time in Access.
>
> When I run the search (which uses a drop-down menu) I get a "data type
> mismatch in criteria expression" error.
>
> I beleive it may be with the dateformat function. Any
> suggestions please?
>
> Thanks in advance. :)
>
> -----------------------------------------------
>
> <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>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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