'=== strPath will hold the page name for naviagtion and sorting strPath = Request.ServerVariables("PATH_INFO") sSQL = "select * from contact " '=== the sort sequence will be passed in from the querystring sort = Request.QueryString("s") If len(sort) > 0 AND isNumeric(sort) Then sSQL = sSQL & " ORDER BY " & sort End If Set rs = Server.CreateObject("ADODB.Recordset") '=== Set number of records per page intPageSize =10 rs.CursorLocation = 3 rs.CursorType = 3 rs.ActiveConnection = ac rs.PageSize = intPageSize rs.CacheSize = rs.PageSize rs.Open sSQL intPageCount = rs.PageCount intRecordCount = rs.RecordCount intPageNum = Request.QueryString("page") If LEN(intPageNum) = 0 Then intPageNum = 1 If CINT(intPageNum) > intPageCount Then intPageNum = intPageCount If CINT(intPageNum) < 1 Then intPageNum = 1 If intRecordCount = 0 Then Response.Write "No records found!" Else rs.AbsolutePage = intPageNum '=== Call the drawPaging routine Call drawPaging Call drawTable(rs,"1","0","5","100%","center") End if Set rs = nothing Set ac = nothing