Dear Prasad:
In my first page, user can select a username to get their procedure record by different categories. After their selection, and click "submit" button, second page appears with the query result. When user click the category link, another query page will show up, with detailed procedure in that category. In addition to the category, I need to write a query using username, which in on the first page. I used a session variable, but it did not work on the third page.
Could you tell me why my code does not work.
Thanks
Haijun
My first page
<!--#include file="ClssfdPage.asp"-->
<BASEFONT FACE="serif" COLOR="black">
<HTML>
<HEAD>
<TITLE>Procedure Summary by Resident</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFF80" text=blue>
<%
dim rsResidentName
dim rsCategory
dim strResidentName
dim strCategory
set rsResidentName = Server.CreateObject("ADODB.Recordset"

set rsCategory = Server.CreateObject("ADODB.Recordset"
strResidentName = "SELECT Firstname, lastName, BaylorID FROM person order by lastname, firstname"
strCategory = "SELECT * FROM category"
rsResidentName.Open strResidentName, objConn,adOpenKeyset,adLockOptimistic
rsCategory.Open strCategory, objConn,adOpenKeyset,adLockOptimistic
%>
<H2 align=center>Procedure Summary by Residents </h2>
<form name=summaryByResident Action=summaryByresident1.asp method = post>
<center>
Resident Name
<SELECT size=1 id=select1 name=ResidentName VALUE="<%=session("ResidentName"

%>">
<% do until rsResidentName.EOF%>
<option Value= <%=rsResidentName("BaylorID"

%>><%=rsResidentName("Lastname"

%>, <%=rsResidentName("Firstname"

%></option>
<% rsResidentName.MoveNext
loop
%>
</SELECT> <br><br>
Procedure Category
<SELECT size=1 id=select2 name=Category2 VALUE="<%= session("category"

%>">
<% do until rsCategory.EOF%>
<option value =<%=rsCategory("categoryAbbrev"

%> ><%=rsCategory("category"

%></option>
<% rsCategory.MoveNext
loop
%>
</SELECT> <br>
<b>Start Date (mm/dd/yy) <INPUT type="text" name=StartDate size = 10> <br></B>
<b>End Date (mm/dd/yy)  <INPUT type="text" name=EndDate size = 10></b>
<br><br><br>
<INPUT type="submit" value="Summary by Residents" id=submit1 name=submit1>
</center>
</form>
<HR>
<TABLE BORDER=0 WIDTH=100%>
<TR ALIGN=CENTER>
<TD WIDTH=33%><A HREF="SummaryByResident.asp">Summary By Resident</A></TD>
</TR>
<TR ALIGN=CENTER>
<TD WIDTH=33%><A HREF="datainput1.asp">Add new procedure</A></TD>
</TR>
<TR align = center>
<TD><A HREF="newpassword.asp">Change your Password<a></TD>
</TR>
</TABLE>
</BODY>
</HTML>
My second page
<!--#include file="ClssfdPage.asp"-->
<BASEFONT FACE="serif" COLOR="black">
<HTML>
<HEAD>
<TITLE>Procedure Summary by Resident</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFF80" text=blue>
<H2 Align=center> Procedure Summary by Residents </h2>
<%
Dim rsSummary
dim strSQLSummary
dim strSelectedName
dim strSelectedCategory
Set rsSummary = Server.CreateObject("ADODB.Recordset"
strSelectedName = Request.Form("ResidentName"

strSelectedCategory = Request.Form ("Category2"
strSQLSummary = "SELECT Count(Prococedure) AS NOProcedure, category FROM FORM_ID_198163500 "
strSQLSummary = strSQLSummary & "WHERE BaylorID= """ & strSelectedName & """" & " GROUP BY category;"
rsSummary.Open strSQLSummary, objConn,adOpenKeyset,adLockOptimistic
If Not rsSummary.EOF Then ' current user has Procedures
Response.Write _
"<TABLE align = ""center"" BORDER=""1"" CELLSPACING=""3"" CELLPADDING=""3"">" & _
"<TR>" & _
" <TH>Category<BR>" & _
" <TH>No. of Procedure<BR>" & _
"</TR>"
Do While Not rsSummary.EOF
Response.Write _
"<TR ALIGN=CENTER>" & _
" <TD>" & "<a href='ProcedureDetails.asp?Details=" & rsSummary("category"

& "'>" & rsSummary("category"

& "</a>" & "</TD>" & _
" <TD>" & rsSummary("NoProcedure"

& "</TD>" & _
"</TR>"
rsSummary.MoveNext
Loop
Response.Write "</TABLE>"
Else ' current user has no Procedures
Response.Write "<CENTER><H2>No Procedures found</H2></CENTER>"
End If
rsSummary.close
%>
<HR>
<TABLE BORDER=0 WIDTH=100%>
<TR ALIGN=CENTER>
<TD WIDTH=33%><A HREF="SummaryByResident.asp">Summary By Resident</A></TD>
</TR>
<TR ALIGN=CENTER>
<TD WIDTH=33%><A HREF="datainput1.asp">Add new procedure</A></TD>
</TR>
<TR align = center>
<TD><A HREF="newpassword.asp">Change your Password<a></TD>
</TR>
</TABLE>
</BODY>
</HTML>
My third ASP page
<!--#include file="ClssfdPage.asp"-->
<%
dim rsProcedures, strQuery, details, residentName
residentname = session("ResidentName"
Details = trim(request("Details"

)
set rsProcedures =server.CreateObject("adodb.recordset"

Response.Write (session("residentName"

)
strQuery = "SELECT DISTINCT prococedure, count(prococedure) as Procedurecount FROM FORM_ID_198163500 "
strQuery = strQuery & "WHERE Category = '" & Details & "'"
strQuery = strQuery & " AND baylorID = '" & session("residentName"

& "'"
strQuery = strQuery & " GROUP BY Prococedure;"
rsProcedures.Open strQuery, objConn,adOpenKeyset,adLockOptimistic
if rsProcedures.EOF then
Response.Write "There are no details available for " & request("Details"
end if
If Not rsProcedures.EOF Then ' current user has Procedures
Response.Write _
"<TABLE align = ""center"" BORDER=""1"" CELLSPACING=""3"" CELLPADDING=""3"">" & _
"<TR>" & _
" <TH>Procedure<BR>" & _
" <TH>Count<BR>" & _
"</TR>"
Do While Not rsProcedures.EOF
Response.Write _
"<TR ALIGN=CENTER>" & _
" <TD>" & rsProcedures("Prococedure"

& "</TD>" & _
" <TD>" & rsProcedures("Procedurecount"

& "</TD>" & _
"</TR>"
rsProcedures.MoveNext
Loop
Response.Write "</TABLE>"
Else ' current user has no Procedures
Response.Write "<CENTER><H2>No Procedures found</H2></CENTER>"
End If
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>