Nope Neither of the above work!
No error messages - just no data displayed!
In trying to get the syntex correct I added a second "where":
strSQL= "SELECT * FROM events where date >="&date()&"and where date <="&dateadd("d",7,date) &" ORDER BY date;"
This also did not work but in the error message I do see that we are picking up the dates - just not the corect format yet! Error message:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'date >=5/31/2003and where date <=6/7/200'.
Complete Code I am using:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsevent 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("midga.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=midga"
'Create an ADO recordset object
Set rsevent = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL= "SELECT * FROM events where date >="&date()&"and where date <="&dateadd("d",7,date) &" ORDER BY date;"
'Open the recordset with the SQL query
rsevent.Open strSQL, adoCon
'Loop through the recordset
Do While not rsevent.EOF
'Write the HTML to display the current record in the recordset
Response.Write ("<br>")
Response.Write ("<a href=""display_form.asp?ID=" & rsevent("ID") & """>")
Response.Write (rsevent("Date"))
Response.Write ("</a>")
Response.Write (" ")
Response.Write ("<b>")
Response.Write (rsevent("eventname"))
Response.Write ("</b>")
Response.Write ("<br>")
' Response.Write (rsevent("church"))
' Response.Write ("<br>")
' Response.Write (rsevent("eventtime"))
' Response.Write ("<br>")
Response.Write (rsevent("description"))
Response.Write ("<br>")
'Move to the next record in the recordset
rsevent.MoveNext
Loop
'Reset server objects
rsevent.Close
Set rsevent = Nothing
Set adoCon = Nothing
%>