Forums

ASP

This topic is locked

Date Search in 8.02

Posted 16 Apr 2007 16:51:07
1
has voted
16 Apr 2007 16:51:07 Stephen Bowker posted:
I am trying to do a date search in my Access Database

I am using the UK format dd/mm/yyyy and am using POST method in the form

On the results page I have set the LCID to 2057

Here is the code from the Recordset on the results page:

<pre id=code><font face=courier size=2 id=code>&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%&gt;
&lt;%Session.LCID=2057%&gt;
&lt;!--#include file="Connections/connHaznm.asp" --&gt;
&lt;%
Dim rsIncident__MMColParam
rsIncident__MMColParam = "01/01/1900"
If (Request.Form("f_Incident_Date" &lt;&gt; "" Then
rsIncident__MMColParam = Request.Form("f_Incident_Date"
End If
%&gt;
&lt;%
Dim rsIncident
Dim rsIncident_cmd
Dim rsIncident_numRows

Set rsIncident_cmd = Server.CreateObject ("ADODB.Command"
rsIncident_cmd.ActiveConnection = MM_connHaznm_STRING
rsIncident_cmd.CommandText = "SELECT * FROM tbl_Term_Contract WHERE f_Incident_Date &gt;= ? ORDER BY f_Incident_Date DESC"
rsIncident_cmd.Prepared = true
rsIncident_cmd.Parameters.Append rsIncident_cmd.CreateParameter("param1", 135, 1, -1, rsIncident__MMColParam) ' adDBTimeStamp

Set rsIncident = rsIncident_cmd.Execute
rsIncident_numRows = 0
%&gt; </font id=code></pre id=code>

It will only accept US date input and even if you reverse the date like so yyyy/mm/dd it still mixes up the days and the months?

anyone any ideas or can they post exisiting working code that I can adapt

Reply to this topic