I'm having a problem with my asp pages. I have the first page set up
to search for data by date and shift. The dates are retrieved by a
query of all dates that are in the database, meaning that if a date has
no data, then that date will not show up in the select box. The shift
is a simple select box with three options in it. When I hit submit, if
there's a date that has the same shift as another date, the date and
the data from that date that posted first will show up, even if I
selected another date. Here's the code below and do you all have any
ideas how this might be happening and ways to correct it. Thanks for
any help I can get.
First Page
<%
'Sets up the connection between the page and the database
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = 3
dbDir = Server.MapPath("fpdb/sacshifttest.mdb")
Connection.Open "DBQ=" & dbDir &"; Driver={Microsoft Access Driver
(*.mdb)}; DriverID=25;FIL=MS Access;"
'Queries for the data from that day
SQLStmt = "SELECT DISTINCT dateRecord FROM SacShiftTest "
Set RS = Connection.Execute(SQLStmt)
%>
..
<td><select name="dateRecord">
<%
do while not RS.EOF
daDate = RS.Fields("dateRecord").Value%>
<option value="dateRecord"><% = daDate %>
<%
RS.MoveNext
Loop
%>
<% Connection.close %>
Next Page:
<%
dateRecord = Replace(Request("dateRecord"), "'", "''")
sacShift = Replace(Request("sacShift"), "'", "''")
'Sets up the connection to the database
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = 3
dbDir = Server.MapPath("fpdb/sacshifttest.mdb")
Connection.Open "DBQ=" & dbDir &"; Driver={Microsoft Access Driver
(*.mdb)}; DriverID=25;FIL=MS Access;"
SQLStmt1 = "SELECT * FROM SacShiftTest WHERE dateRecord = " & dateRecord
& " AND sacShift='" & sacShift & "' AND testnum='1' "
Set RS1 = Connection.Execute(SQLStmt1)
%>
--
Posted via http://dbforums.com