Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strSQL ' The SQL Query we build
Dim t ' Today's Date
Dim vbShortDate ' So the Date can be mm/dd/yy
vbShortDate = 2
Dim w ' Week from today's date
t = FormatDateTime(Now(),vbShortDate) 'Today's date
w = DateAdd("d","7",Now()) 'week from today's date
w = FormatDateTime(w,vbShortDate)
Set cnnSearch = Server.CreateObject("ADODB.Connection"
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\
' Now we do our statement to query db.
'find records where due date is between today and a week from today
strSQL = "Select * FROM Projects " _
& "WHERE DueDate >= "& t &" And DueDate <= "& w &" " _
& "ORDER by DueDate"
set rstSearch = cnnSearch.Execute(strSQL)
Last line is the one that is getting the error message.
Have also tried to use
Set rstSearch = Server.CreateObject("ADODB.Recordset"
before SQL statement but get same error
Can anyone see what is wrong?
Thanks
Dim rstSearch ' ADO recordset
Dim strSQL ' The SQL Query we build
Dim t ' Today's Date
Dim vbShortDate ' So the Date can be mm/dd/yy
vbShortDate = 2
Dim w ' Week from today's date
t = FormatDateTime(Now(),vbShortDate) 'Today's date
w = DateAdd("d","7",Now()) 'week from today's date
w = FormatDateTime(w,vbShortDate)
Set cnnSearch = Server.CreateObject("ADODB.Connection"
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\
' Now we do our statement to query db.
'find records where due date is between today and a week from today
strSQL = "Select * FROM Projects " _
& "WHERE DueDate >= "& t &" And DueDate <= "& w &" " _
& "ORDER by DueDate"
set rstSearch = cnnSearch.Execute(strSQL)
Last line is the one that is getting the error message.
Have also tried to use
Set rstSearch = Server.CreateObject("ADODB.Recordset"
before SQL statement but get same error
Can anyone see what is wrong?
Thanks