Spyder1000
Technical User
I've got an access backend with a date field. I'd like to be able to limit returned results based on this field. The following is the code that i've written which works great with a text field but gives an error when used with a date.
The error:
My code:
The error:
Code:
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
/GT4Challenge/viewrecord.asp, line 22
My code:
Code:
<HTML>
<BODY>
<br><b>Date</b></br>
<form method="POST" name="date">
<input type="text" name="date" size="16"><p> </p>
</p>
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2">
</select>
<p> </p>
</form>
<%
Set objConn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
FilePath = Server.MapPath("database.mdb")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath & ";"
objConn.Open strConn
SQL_query = "SELECT * FROM tbl_maintable WHERE [Date] = '"&request.form("Date")&"' Order By [shippernumber]"
RS.Open SQL_query, objConn
%>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-top-width:0" bordercolor="#111111" width="80%" id="AutoNumber2">
<tr>
<td width="15%" bgcolor="#000080" align="center" style="border-bottom-style: solid; border-bottom-width: 1; border-top-style:none; border-top-width:medium">
<b><font color="#FFFFFF">Account Number</font></b></td>
<td width="35%" bgcolor="#000080" align="center" style="border-bottom-style: solid; border-bottom-width: 1; border-top-style:none; border-top-width:medium">
<font color="#FFFFFF"><b>Tracking Number</b></font></td>
<td width="25%" bgcolor="#000080" align="center" style="border-bottom-style: solid; border-bottom-width: 1; border-top-style:none; border-top-width:medium">
<font color="#FFFFFF"><b>Refund Amount</b></font></td>
<td width="25%" bgcolor="#000080" align="center" style="border-bottom-style: solid; border-bottom-width: 1; border-top-style:none; border-top-width:medium">
<font color="#FFFFFF"><b>Status</b></font></td>
</tr>
<%WHILE NOT RS.EOF%>
</table>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-left-width:0; border-right-width:0; border-top-width:0" bordercolor="#111111" width="80%" id="AutoNumber1">
<tr>
<td width="15%" style="border-bottom-style: solid; border-bottom-width: 1; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium" align="center"><%=RS("shippernumber")%> </td>
<td width="32%" style="border-bottom-style: solid; border-bottom-width: 1; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium" align="center"><%=RS("trackingnumber")%> </td>
<td width="25%" style="border-bottom-style: solid; border-bottom-width: 1; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium" align="center"><%=RS("refundamount")%> </td>
<td width="25%" style="border-bottom-style: solid; border-bottom-width: 1; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium" align="center"><%=RS("status")%> </td>
</tr>
</table>
<%
RS.MoveNext
WEND
%>
</BODY>