Hello Experts.
I am unable to retrieve records base on a date. Could you please help me.
Here is my code for user to insert a date :
Here is my code for quering access database for the date
I get an error message Microsoft JET Database Engine (0x80040E07)
Syntax error in date in query expression 'datecreated = # #'.
When I use a constant date e.g
strSQL = "SELECT * from approval where datecreated = #01/01/2001#"
Then, the code works well. But I want to search the database on a date condition, i.e from the date the user has entered
I am unable to retrieve records base on a date. Could you please help me.
Here is my code for user to insert a date :
Code:
<form name="hello" method="post" action="querytable.asp"> Please enter date (mm/dd/yyyy)<input type="text" name="adate"> <input type="submit" name="submit" value="submit"> <form>
Code:
<% @language="VBScript" %> <% option explicit %> <% dim strDate strDate = request.form("adate") dim adorst, adocon, strSQL, rst, sql set adocon = server.createobject("ADODB.connection") adocon.open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & server.mapPath("sp.mdb")) set adorst = server.createobject("ADODB.recordset") strSQL = "SELECT * from approval where datecreated = # " & strDate & " #" adorst.open strSQL, adocon %>
Syntax error in date in query expression 'datecreated = # #'.
When I use a constant date e.g
strSQL = "SELECT * from approval where datecreated = #01/01/2001#"
Then, the code works well. But I want to search the database on a date condition, i.e from the date the user has entered
Comment