I am trying to do a single page form for a Date Range query, with no luck.
I have a record in 'counts.sentdate' with 03/24/2009 but when I use a range
in the form of 03/20/2009 to 03/26/2009 no records are retrieved. I have
also tried it as a 'form/action page' two part with same results. Any
suggestions? Is it the dateformating?
<cfparam name="request.submit" default="">
<cfif request.submit eq "Submit">
<cfelse>
<!--- show form --->
<form method="post" action="#" name="ranges">
<p>Start Date:
<input type="text" name="startDate" value="<cfoutput>#DateFormat(Now(),
'mm/dd/yyyy')#</cfoutput>" onfocus="this.value=''"
style="background-color:#f2f2f2;">
<br>
End Date:
<input type="text" name="endDate" value="<cfoutput>#DateFormat(Now(),
'mm/dd/yyyy')#</cfoutput>" onfocus="this.value=''"
style="background-color:#f2f2f2;">
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</cfif>
------------------
<cfquery name="testresults" >
SELECT *
From counts
WHERE ((counts.sentDate BETWEEN #CreateODBCDate(form.StartDate)# AND
#CreateODBCDate(form.EndDate)#))
ORDER BY msgtype
</cfquery>
-------------------
<table cellpadding="1" cellspacing="0" width="100%" border="1"
bordercolor="silver">
<tr>
<th>Member Name</th>
<th>Completed</th>
</tr>
<!-- IF THERE ARE NO RESULTS -->
<cfif #testresults.recordcount# is 0>
<tr>
<td colspan="2" align="center">No records found in that date
range</td>
</tr>
</cfif>
<!-- IF THERE ARE RESULTS THEN DISPLAY THEM -->
<cfoutput query="testresults">
<tr>
<td>#testresults.msgType#</td>
<td>#DateFormat(testresults.sentDate, 'mm/dd/yyyy')#</td>
</tr>
</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321004
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4