I am working on a set of pages where a user searches for records over a range of dates, and then they can select a sub-set of those records to be exported to excel.
So far I have the date range search set up on one page - I'll call it search.asp. It's pretty simple - a form with two text boxes and a submit button. The values from the test boxes are passed to two session variables.
The second page (list.asp) returns the matching records. I'm doing this in DreamweaverMX and am using the "repeat region" server behavior to display all of the records in a table. This all works just fine.
The table with the records is inside a form. (The action property is set to "") There is a checkbox that is used to indicate each record that should be exported. The value of this field is set to the recordID for each record that is checked.
There is also a submit button and it is here that I am running into problems. No matter what I try to have happen when the submit button is clicked, I always get an error in the SQL statement that defines the recordset that is being already being displayed.
Here is the code for the recordset (which works when list.asp is first loaded):
Right now, all I am doing with the submit button is:
(test.asp is just a blank page. Eventually this will be replaced with code that selects the records and then redirects to the excel sheet)
Here is what I get when I try to submit the form -
Microsoft JET Database Engine (0x80040E07)
Syntax error in date in query expression 'dtSubmitted Between ## AND ##'.
/internal/admin_MolSeqQryDate2.asp, line 60
First, it is obviously "losing" the dates, but I'm not sure why since a)this works when the page is loaded and b) I can display the values of the session variables that hold the dates on list.asp as well as on other pages.
Second, why is it trying to do anything with this recordset even in this very oversimplified case where I am just redirecting to another page?
Any help/suggestions would be greatly appreciated!
So far I have the date range search set up on one page - I'll call it search.asp. It's pretty simple - a form with two text boxes and a submit button. The values from the test boxes are passed to two session variables.
The second page (list.asp) returns the matching records. I'm doing this in DreamweaverMX and am using the "repeat region" server behavior to display all of the records in a table. This all works just fine.
The table with the records is inside a form. (The action property is set to "") There is a checkbox that is used to indicate each record that should be exported. The value of this field is set to the recordID for each record that is checked.
There is also a submit button and it is here that I am running into problems. No matter what I try to have happen when the submit button is clicked, I always get an error in the SQL statement that defines the recordset that is being already being displayed.
Here is the code for the recordset (which works when list.asp is first loaded):
Code:
<%
Dim SearchByDate
Dim SearchByDate_numRows
Set SearchByDate = Server.CreateObject("ADODB.Recordset")
SearchByDate.ActiveConnection = MM_DERC_STRING
SearchByDate.Source = "SELECT dtSubmitted, dtCompleted, numRequest, numSamples, txtLabMember, txtPI_name, txtServiceAbbr, ynExport FROM qryMolSeq_QryDate WHERE dtSubmitted Between #" + Session("Dt1") + "# AND #" + Session("Dt2") +"# ORDER BY numRequest ASC"
SearchByDate.CursorType = 0
SearchByDate.CursorLocation = 2
SearchByDate.LockType = 1
SearchByDate.Open()
SearchByDate_numRows = 0
%>
Right now, all I am doing with the submit button is:
Code:
<%If Request("Submit") <> "" Then
response.redirect("test.asp")
End If %>
Here is what I get when I try to submit the form -
Microsoft JET Database Engine (0x80040E07)
Syntax error in date in query expression 'dtSubmitted Between ## AND ##'.
/internal/admin_MolSeqQryDate2.asp, line 60
First, it is obviously "losing" the dates, but I'm not sure why since a)this works when the page is loaded and b) I can display the values of the session variables that hold the dates on list.asp as well as on other pages.
Second, why is it trying to do anything with this recordset even in this very oversimplified case where I am just redirecting to another page?
Any help/suggestions would be greatly appreciated!