%@ LCID = 5129 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" Response.CacheControl = "no-cache" %> <% ' Initialize common variables x_ID = Null: ox_ID = Null: z_ID = Null x_Group_ID = Null: ox_Group_ID = Null: z_Group_ID = Null x_Pupil_Name = Null: ox_Pupil_Name = Null: z_Pupil_Name = Null x_DOB = Null: ox_DOB = Null: z_DOB = Null x_College = Null: ox_College = Null: z_College = Null x_Form = Null: ox_Form = Null: z_Form = Null x_Cell = Null: ox_Cell = Null: z_Cell = Null x_Dean = Null: ox_Dean = Null: z_Dean = Null x_Contact1 = Null: ox_Contact1 = Null: z_Contact1 = Null x_Contact2 = Null: ox_Contact2 = Null: z_Contact2 = Null x_Address = Null: ox_Address = Null: z_Address = Null x_Address2 = Null: ox_Address2 = Null: z_Address2 = Null x_Address3 = Null: ox_Address3 = Null: z_Address3 = Null x_Subject1 = Null: ox_Subject1 = Null: z_Subject1 = Null x_Subject2 = Null: ox_Subject2 = Null: z_Subject2 = Null x_Subject3 = Null: ox_Subject3 = Null: z_Subject3 = Null x_Subject4 = Null: ox_Subject4 = Null: z_Subject4 = Null x_Subject5 = Null: ox_Subject5 = Null: z_Subject5 = Null x_Subject6 = Null: ox_Subject6 = Null: z_Subject6 = Null x_Subject7 = Null: ox_Subject7 = Null: z_Subject7 = Null x_Attendance = Null: ox_Attendance = Null: z_Attendance = Null x_Comments = Null: ox_Comments = Null: z_Comments = Null x_Date = Null: ox_Date = Null: z_Date = Null x_AtSchool = Null: ox_AtSchool = Null: z_AtSchool = Null x_Spare = Null: ox_Spare = Null: z_Spare = Null %> <% nStartRec = 0 nStopRec = 0 nTotalRecs = 0 nRecCount = 0 nRecActual = 0 sDbWhereMaster = "" sDbWhereDetail = "" sSrchAdvanced = "" psearch = "" psearchtype = "" sSrchBasic = "" sSrchWhere = "" sDbWhere = "" sOrderBy = "" sSqlMaster = "" nDisplayRecs = 20 nRecRange = 10 ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str ' Handle Reset Command ResetCmd() ' Get Search Criteria for Basic Search SetUpBasicSearch() ' Build Search Criteria If sSrchAdvanced <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchAdvanced & ")" End If If sSrchBasic <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchBasic & ")" End If ' Save Search Criteria If sSrchWhere <> "" Then Session(ewSessionTblSearchWhere) = sSrchWhere nStartRec = 1 ' reset start record counter Session(ewSessionTblStartRec) = nStartRec Else sSrchWhere = Session(ewSessionTblSearchWhere) Call RestoreSearch() End If ' Build Filter condition sDbWhere = "" If sDbWhereDetail <> "" Then sDbWhere = sDbWhere & "(" & sDbWhereDetail & ") AND " End If If sSrchWhere <> "" Then sDbWhere = sDbWhere & "(" & sSrchWhere & ") AND " End If If Len(sDbWhere) > 5 Then sDbWhere = Mid(sDbWhere, 1, Len(sDbWhere)-5) ' Trim rightmost AND End If ' Set Up Sorting Order sOrderBy = "" SetUpSortOrder() ' Set up SQL sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sDbWhere, sOrderBy) 'Response.Write sSql ' Uncomment to show SQL for debugging %> <% ' Set up Record Set Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 nTotalRecs = rs.RecordCount If nDisplayRecs <= 0 Then ' Display All Records nDisplayRecs = nTotalRecs End If nStartRec = 1 SetUpStartRec() ' Set Up Start Record Position %>
Add |
<% If Session(ewSessionMessage) <> "" Then %>
<%= Session(ewSessionMessage) %>
<% Session(ewSessionMessage) = "" ' Clear message End If %> <% If nTotalRecs > 0 Then %> <% End If %> <% ' Close recordset and connection rs.Close Set rs = Nothing conn.Close Set conn = Nothing %> <% '------------------------------------------------------------------------------- ' Function BasicSearchSQL ' - Build WHERE clause for a keyword Function BasicSearchSQL(Keyword) Dim sKeyword sKeyword = AdjustSql(Keyword) BasicSearchSQL = "" BasicSearchSQL = BasicSearchSQL & "[Pupil_Name] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[College] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Form] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Dean] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Address] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Address2] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Address3] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject1] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject2] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject3] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject4] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject5] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject6] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Subject7] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Attendance] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Comments] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Spare] LIKE '%" & sKeyword & "%' OR " If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4) End Function '------------------------------------------------------------------------------- ' Function SetUpBasicSearch ' - Set up Basic Search parameter based on form elements pSearch & pSearchType ' - Variables setup: sSrchBasic Sub SetUpBasicSearch() Dim arKeyword, sKeyword psearch = Request.QueryString(ewTblBasicSrch) psearchtype = Request.QueryString(ewTblBasicSrchType) If psearch <> "" Then If psearchtype <> "" Then While InStr(psearch, " ") > 0 sSearch = Replace(psearch, " ", " ") Wend arKeyword = Split(Trim(psearch), " ") For Each sKeyword In arKeyword sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & psearch & " " Next Else sSrchBasic = BasicSearchSQL(psearch) End If End If If Right(sSrchBasic, 4) = " OR " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-4) If Right(sSrchBasic, 5) = " AND " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-5) If psearch <> "" then Session(ewSessionTblBasicSrch) = psearch Session(ewSessionTblBasicSrchType) = psearchtype End If End Sub '------------------------------------------------------------------------------- ' Function ResetSearch ' - Clear all search parameters ' Sub ResetSearch() ' Clear search where sSrchWhere = "" Session(ewSessionTblSearchWhere) = sSrchWhere ' Clear advanced search parameters Session(ewSessionTblAdvSrch & "_x_ID") = "" Session(ewSessionTblAdvSrch & "_x_Group_ID") = "" Session(ewSessionTblAdvSrch & "_x_Pupil_Name") = "" Session(ewSessionTblAdvSrch & "_x_DOB") = "" Session(ewSessionTblAdvSrch & "_x_College") = "" Session(ewSessionTblAdvSrch & "_x_Form") = "" Session(ewSessionTblAdvSrch & "_x_Cell") = "" Session(ewSessionTblAdvSrch & "_x_Dean") = "" Session(ewSessionTblAdvSrch & "_x_Contact1") = "" Session(ewSessionTblAdvSrch & "_x_Contact2") = "" Session(ewSessionTblAdvSrch & "_x_Address") = "" Session(ewSessionTblAdvSrch & "_x_Address2") = "" Session(ewSessionTblAdvSrch & "_x_Address3") = "" Session(ewSessionTblAdvSrch & "_x_Subject1") = "" Session(ewSessionTblAdvSrch & "_x_Subject2") = "" Session(ewSessionTblAdvSrch & "_x_Subject3") = "" Session(ewSessionTblAdvSrch & "_x_Subject4") = "" Session(ewSessionTblAdvSrch & "_x_Subject5") = "" Session(ewSessionTblAdvSrch & "_x_Subject6") = "" Session(ewSessionTblAdvSrch & "_x_Subject7") = "" Session(ewSessionTblAdvSrch & "_x_Attendance") = "" Session(ewSessionTblAdvSrch & "_x_Comments") = "" Session(ewSessionTblAdvSrch & "_x_Date") = "" Session(ewSessionTblAdvSrch & "_x_AtSchool") = "" Session(ewSessionTblAdvSrch & "_x_Spare") = "" Session(ewSessionTblBasicSrch) = "" Session(ewSessionTblBasicSrchType) = "" End Sub '------------------------------------------------------------------------------- ' Function RestoreSearch ' - Restore all search parameters ' Sub RestoreSearch() ' Restore advanced search settings x_ID = Session(ewSessionTblAdvSrch & "_x_ID") x_Group_ID = Session(ewSessionTblAdvSrch & "_x_Group_ID") x_Pupil_Name = Session(ewSessionTblAdvSrch & "_x_Pupil_Name") x_DOB = Session(ewSessionTblAdvSrch & "_x_DOB") x_College = Session(ewSessionTblAdvSrch & "_x_College") x_Form = Session(ewSessionTblAdvSrch & "_x_Form") x_Cell = Session(ewSessionTblAdvSrch & "_x_Cell") x_Dean = Session(ewSessionTblAdvSrch & "_x_Dean") x_Contact1 = Session(ewSessionTblAdvSrch & "_x_Contact1") x_Contact2 = Session(ewSessionTblAdvSrch & "_x_Contact2") x_Address = Session(ewSessionTblAdvSrch & "_x_Address") x_Address2 = Session(ewSessionTblAdvSrch & "_x_Address2") x_Address3 = Session(ewSessionTblAdvSrch & "_x_Address3") x_Subject1 = Session(ewSessionTblAdvSrch & "_x_Subject1") x_Subject2 = Session(ewSessionTblAdvSrch & "_x_Subject2") x_Subject3 = Session(ewSessionTblAdvSrch & "_x_Subject3") x_Subject4 = Session(ewSessionTblAdvSrch & "_x_Subject4") x_Subject5 = Session(ewSessionTblAdvSrch & "_x_Subject5") x_Subject6 = Session(ewSessionTblAdvSrch & "_x_Subject6") x_Subject7 = Session(ewSessionTblAdvSrch & "_x_Subject7") x_Attendance = Session(ewSessionTblAdvSrch & "_x_Attendance") x_Comments = Session(ewSessionTblAdvSrch & "_x_Comments") x_Date = Session(ewSessionTblAdvSrch & "_x_Date") x_AtSchool = Session(ewSessionTblAdvSrch & "_x_AtSchool") x_Spare = Session(ewSessionTblAdvSrch & "_x_Spare") psearch = Session(ewSessionTblBasicSrch) psearchtype = Session(ewSessionTblBasicSrchType) End Sub '------------------------------------------------------------------------------- ' Function SetUpSortOrder ' - Set up Sort parameters based on Sort Links clicked ' - Variables setup: sOrderBy, Session(TblOrderBy), Session(Tbl_Field_Sort) Sub SetUpSortOrder() Dim sOrder, sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then sOrder = Request.QueryString("order") ' Field [ID] If sOrder = "ID" Then sSortField = "[ID]" sLastSort = Session(ewSessionTblSort & "_x_ID") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_ID") = sThisSort Else If Session(ewSessionTblSort & "_x_ID") <> "" Then Session(ewSessionTblSort & "_x_ID") = "" End If ' Field [Group_ID] If sOrder = "Group_ID" Then sSortField = "[Group_ID]" sLastSort = Session(ewSessionTblSort & "_x_Group_ID") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Group_ID") = sThisSort Else If Session(ewSessionTblSort & "_x_Group_ID") <> "" Then Session(ewSessionTblSort & "_x_Group_ID") = "" End If ' Field [Pupil_Name] If sOrder = "Pupil_Name" Then sSortField = "[Pupil_Name]" sLastSort = Session(ewSessionTblSort & "_x_Pupil_Name") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Pupil_Name") = sThisSort Else If Session(ewSessionTblSort & "_x_Pupil_Name") <> "" Then Session(ewSessionTblSort & "_x_Pupil_Name") = "" End If ' Field [DOB] If sOrder = "DOB" Then sSortField = "[DOB]" sLastSort = Session(ewSessionTblSort & "_x_DOB") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_DOB") = sThisSort Else If Session(ewSessionTblSort & "_x_DOB") <> "" Then Session(ewSessionTblSort & "_x_DOB") = "" End If ' Field [College] If sOrder = "College" Then sSortField = "[College]" sLastSort = Session(ewSessionTblSort & "_x_College") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_College") = sThisSort Else If Session(ewSessionTblSort & "_x_College") <> "" Then Session(ewSessionTblSort & "_x_College") = "" End If ' Field [Form] If sOrder = "Form" Then sSortField = "[Form]" sLastSort = Session(ewSessionTblSort & "_x_Form") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Form") = sThisSort Else If Session(ewSessionTblSort & "_x_Form") <> "" Then Session(ewSessionTblSort & "_x_Form") = "" End If ' Field [Cell] If sOrder = "Cell" Then sSortField = "[Cell]" sLastSort = Session(ewSessionTblSort & "_x_Cell") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Cell") = sThisSort Else If Session(ewSessionTblSort & "_x_Cell") <> "" Then Session(ewSessionTblSort & "_x_Cell") = "" End If ' Field [Dean] If sOrder = "Dean" Then sSortField = "[Dean]" sLastSort = Session(ewSessionTblSort & "_x_Dean") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Dean") = sThisSort Else If Session(ewSessionTblSort & "_x_Dean") <> "" Then Session(ewSessionTblSort & "_x_Dean") = "" End If ' Field [Contact1] If sOrder = "Contact1" Then sSortField = "[Contact1]" sLastSort = Session(ewSessionTblSort & "_x_Contact1") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Contact1") = sThisSort Else If Session(ewSessionTblSort & "_x_Contact1") <> "" Then Session(ewSessionTblSort & "_x_Contact1") = "" End If ' Field [Contact2] If sOrder = "Contact2" Then sSortField = "[Contact2]" sLastSort = Session(ewSessionTblSort & "_x_Contact2") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Contact2") = sThisSort Else If Session(ewSessionTblSort & "_x_Contact2") <> "" Then Session(ewSessionTblSort & "_x_Contact2") = "" End If ' Field [Address] If sOrder = "Address" Then sSortField = "[Address]" sLastSort = Session(ewSessionTblSort & "_x_Address") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Address") = sThisSort Else If Session(ewSessionTblSort & "_x_Address") <> "" Then Session(ewSessionTblSort & "_x_Address") = "" End If ' Field [Address2] If sOrder = "Address2" Then sSortField = "[Address2]" sLastSort = Session(ewSessionTblSort & "_x_Address2") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Address2") = sThisSort Else If Session(ewSessionTblSort & "_x_Address2") <> "" Then Session(ewSessionTblSort & "_x_Address2") = "" End If ' Field [Address3] If sOrder = "Address3" Then sSortField = "[Address3]" sLastSort = Session(ewSessionTblSort & "_x_Address3") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Address3") = sThisSort Else If Session(ewSessionTblSort & "_x_Address3") <> "" Then Session(ewSessionTblSort & "_x_Address3") = "" End If ' Field [Subject1] If sOrder = "Subject1" Then sSortField = "[Subject1]" sLastSort = Session(ewSessionTblSort & "_x_Subject1") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject1") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject1") <> "" Then Session(ewSessionTblSort & "_x_Subject1") = "" End If ' Field [Subject2] If sOrder = "Subject2" Then sSortField = "[Subject2]" sLastSort = Session(ewSessionTblSort & "_x_Subject2") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject2") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject2") <> "" Then Session(ewSessionTblSort & "_x_Subject2") = "" End If ' Field [Subject3] If sOrder = "Subject3" Then sSortField = "[Subject3]" sLastSort = Session(ewSessionTblSort & "_x_Subject3") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject3") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject3") <> "" Then Session(ewSessionTblSort & "_x_Subject3") = "" End If ' Field [Subject4] If sOrder = "Subject4" Then sSortField = "[Subject4]" sLastSort = Session(ewSessionTblSort & "_x_Subject4") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject4") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject4") <> "" Then Session(ewSessionTblSort & "_x_Subject4") = "" End If ' Field [Subject5] If sOrder = "Subject5" Then sSortField = "[Subject5]" sLastSort = Session(ewSessionTblSort & "_x_Subject5") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject5") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject5") <> "" Then Session(ewSessionTblSort & "_x_Subject5") = "" End If ' Field [Subject6] If sOrder = "Subject6" Then sSortField = "[Subject6]" sLastSort = Session(ewSessionTblSort & "_x_Subject6") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject6") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject6") <> "" Then Session(ewSessionTblSort & "_x_Subject6") = "" End If ' Field [Subject7] If sOrder = "Subject7" Then sSortField = "[Subject7]" sLastSort = Session(ewSessionTblSort & "_x_Subject7") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Subject7") = sThisSort Else If Session(ewSessionTblSort & "_x_Subject7") <> "" Then Session(ewSessionTblSort & "_x_Subject7") = "" End If ' Field [Attendance] If sOrder = "Attendance" Then sSortField = "[Attendance]" sLastSort = Session(ewSessionTblSort & "_x_Attendance") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Attendance") = sThisSort Else If Session(ewSessionTblSort & "_x_Attendance") <> "" Then Session(ewSessionTblSort & "_x_Attendance") = "" End If ' Field [Comments] If sOrder = "Comments" Then sSortField = "[Comments]" sLastSort = Session(ewSessionTblSort & "_x_Comments") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Comments") = sThisSort Else If Session(ewSessionTblSort & "_x_Comments") <> "" Then Session(ewSessionTblSort & "_x_Comments") = "" End If ' Field [Date] If sOrder = "Date" Then sSortField = "[Date]" sLastSort = Session(ewSessionTblSort & "_x_Date") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Date") = sThisSort Else If Session(ewSessionTblSort & "_x_Date") <> "" Then Session(ewSessionTblSort & "_x_Date") = "" End If ' Field [AtSchool] If sOrder = "AtSchool" Then sSortField = "[AtSchool]" sLastSort = Session(ewSessionTblSort & "_x_AtSchool") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_AtSchool") = sThisSort Else If Session(ewSessionTblSort & "_x_AtSchool") <> "" Then Session(ewSessionTblSort & "_x_AtSchool") = "" End If ' Field [Spare] If sOrder = "Spare" Then sSortField = "[Spare]" sLastSort = Session(ewSessionTblSort & "_x_Spare") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_Spare") = sThisSort Else If Session(ewSessionTblSort & "_x_Spare") <> "" Then Session(ewSessionTblSort & "_x_Spare") = "" End If Session(ewSessionTblOrderBy) = sSortField & " " & sThisSort Session(ewSessionTblStartRec) = 1 End If sOrderBy = Session(ewSessionTblOrderBy) If sOrderBy = "" Then sOrderBy = ewSqlOrderBy Session(ewSessionTblOrderBy) = sOrderBy End If End Sub '------------------------------------------------------------------------------- ' Function SetUpStartRec ' - Set up Starting Record parameters based on Pager Navigation ' - Variables setup: nStartRec Sub SetUpStartRec() Dim nPageNo ' Check for a START parameter If Request.QueryString(ewTblStartRec).Count > 0 Then nStartRec = Request.QueryString(ewTblStartRec) Session(ewSessionTblStartRec) = nStartRec ElseIf Request.QueryString("pageno").Count > 0 Then nPageNo = Request.QueryString("pageno") If IsNumeric(nPageNo) Then nStartRec = (nPageNo-1)*nDisplayRecs+1 If nStartRec <= 0 Then nStartRec = 1 ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 End If Session(ewSessionTblStartRec) = nStartRec Else nStartRec = Session(ewSessionTblStartRec) If Not IsNumeric(nStartRec) Or nStartRec = "" Then nStartRec = 1 ' Reset start record counter Session(ewSessionTblStartRec) = nStartRec End If End If Else nStartRec = Session(ewSessionTblStartRec) If Not IsNumeric(nStartRec) Or nStartRec = "" Then nStartRec = 1 'Reset start record counter Session(ewSessionTblStartRec) = nStartRec End If End If End Sub '------------------------------------------------------------------------------- ' Function ResetCmd ' - Clear list page parameters ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters Sub ResetCmd() Dim sCmd ' Get Reset Cmd If Request.QueryString("cmd").Count > 0 Then sCmd = Request.QueryString("cmd") ' Reset Search Criteria If LCase(sCmd) = "reset" Then Call ResetSearch() ' Reset Search Criteria & Session Keys ElseIf LCase(sCmd) = "resetall" Then Call ResetSearch() ' Reset Sort Criteria ElseIf LCase(sCmd) = "resetsort" Then sOrderBy = "" Session(ewSessionTblOrderBy) = sOrderBy If Session(ewSessionTblSort & "_x_ID") <> "" Then Session(ewSessionTblSort & "_x_ID") = "" If Session(ewSessionTblSort & "_x_Group_ID") <> "" Then Session(ewSessionTblSort & "_x_Group_ID") = "" If Session(ewSessionTblSort & "_x_Pupil_Name") <> "" Then Session(ewSessionTblSort & "_x_Pupil_Name") = "" If Session(ewSessionTblSort & "_x_DOB") <> "" Then Session(ewSessionTblSort & "_x_DOB") = "" If Session(ewSessionTblSort & "_x_College") <> "" Then Session(ewSessionTblSort & "_x_College") = "" If Session(ewSessionTblSort & "_x_Form") <> "" Then Session(ewSessionTblSort & "_x_Form") = "" If Session(ewSessionTblSort & "_x_Cell") <> "" Then Session(ewSessionTblSort & "_x_Cell") = "" If Session(ewSessionTblSort & "_x_Dean") <> "" Then Session(ewSessionTblSort & "_x_Dean") = "" If Session(ewSessionTblSort & "_x_Contact1") <> "" Then Session(ewSessionTblSort & "_x_Contact1") = "" If Session(ewSessionTblSort & "_x_Contact2") <> "" Then Session(ewSessionTblSort & "_x_Contact2") = "" If Session(ewSessionTblSort & "_x_Address") <> "" Then Session(ewSessionTblSort & "_x_Address") = "" If Session(ewSessionTblSort & "_x_Address2") <> "" Then Session(ewSessionTblSort & "_x_Address2") = "" If Session(ewSessionTblSort & "_x_Address3") <> "" Then Session(ewSessionTblSort & "_x_Address3") = "" If Session(ewSessionTblSort & "_x_Subject1") <> "" Then Session(ewSessionTblSort & "_x_Subject1") = "" If Session(ewSessionTblSort & "_x_Subject2") <> "" Then Session(ewSessionTblSort & "_x_Subject2") = "" If Session(ewSessionTblSort & "_x_Subject3") <> "" Then Session(ewSessionTblSort & "_x_Subject3") = "" If Session(ewSessionTblSort & "_x_Subject4") <> "" Then Session(ewSessionTblSort & "_x_Subject4") = "" If Session(ewSessionTblSort & "_x_Subject5") <> "" Then Session(ewSessionTblSort & "_x_Subject5") = "" If Session(ewSessionTblSort & "_x_Subject6") <> "" Then Session(ewSessionTblSort & "_x_Subject6") = "" If Session(ewSessionTblSort & "_x_Subject7") <> "" Then Session(ewSessionTblSort & "_x_Subject7") = "" If Session(ewSessionTblSort & "_x_Attendance") <> "" Then Session(ewSessionTblSort & "_x_Attendance") = "" If Session(ewSessionTblSort & "_x_Comments") <> "" Then Session(ewSessionTblSort & "_x_Comments") = "" If Session(ewSessionTblSort & "_x_Date") <> "" Then Session(ewSessionTblSort & "_x_Date") = "" If Session(ewSessionTblSort & "_x_AtSchool") <> "" Then Session(ewSessionTblSort & "_x_AtSchool") = "" If Session(ewSessionTblSort & "_x_Spare") <> "" Then Session(ewSessionTblSort & "_x_Spare") = "" End If ' Reset Start Position (Reset Command) nStartRec = 1 Session(ewSessionTblStartRec) = nStartRec End If End Sub %>