>- see footer for list info -< Aaaarrrggggggghhhhhhhh NOT DATES AGAIN
Get rid of the LSDateFormat <CFSET start_date = CreateODBCDate(Year(arguments.startDate),Month(arguments.startDate),Day( arguments.startDate))> <CFSET end_date = CreateODBCDate(Year(arguments.endDate),Month(arguments.endDate),Day(argu ments.endDate))> SELECT * FROM Table WHERE DateOfQuery BETWEEN #start_date# And #end_date# Allan -----Original Message----- From: Stephen Adams [mailto:[EMAIL PROTECTED] Sent: 31 January 2006 12:20 To: Coldfusion Development Subject: [CF-Dev] Filtering using dates >- see footer for list info -< Hi, I'm trying to run a query against an Access DB, with dates in UK format, but I keep getting Type mismatch in expression error messages. In my application the user selects two dates from a Flash Form date time field, these dates are then passed into a cffunction as arguments. In the function I set the passed arguments as dates using the CreateODBCDate funciton, like this: <cfset start_date = #LSDateFormat(CreateODBCDate(arguments.startDate ),'dd/mm/yyyy')#> <cfset end_date = #LSDateFormat(CreateODBCDate(arguments.endDate ),'dd/mm/yyyy')#> I also format the dates. Then in my query I'm trying to use a BETWEEN to get a list back. Here's my query: <cfquery name="qGetDataExtract" datasource="#variables.DSN#"> SELECT q.QueryID AS QueryID, q.DRB_Number AS DRB_Number, q.Name AS Name, q.Contact AS Contact, q.TimeOfQuery AS TimeOfQuery, q.DateOfQuery AS DateOfQuery, a.QueryActionDesc AS CallAction, b.QueryTypeDesc AS QueryType FROM tbl_Queries q, tbl_QueryActions a, tbl_QueryType b WHERE q.DateOfQuery BETWEEN #start_date# And #end_date# AND a.QueryActionID = q.CallType AND b.QueryTypeID = q.QueryTypeID </cfquery> My dates in the Access table are being saved as Date/Time fields, with a format of Short Date and an Input Mask of dd/mm/yyyy. All the examples I've seen use CreateODBCDate and seem to work, but a lot are in US date format. Can anyone show me what I need to do to fix this problem in my code? Thanks Stephen _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help >-< ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
