ok sweet leaf, i have not really used something like this but the below code is d/l from some site (it creates a sortable HTML Table)check whether it helps, or atleast gives u a start....
<%
'***************************************
'Procedure: createSortableList(objConn,
' strSQL, strDefaultSort, intPageSize,
' strLnkedColumnName,strLink,
' strTableAttributes)
'
'Returns: writes a sortable, pagable htm
' l table fill with records from a query
'
'Inputs:
' objConn = a connection object
' strSQL = a string of SQL
' strDefaultSort = a string of the default
' lt sorting column (i.e "FirstName"

' intPageSize = integer of the number of
' records per page
' strLinkedColumnName = a string of the
' column to place a link on
' strLink = a string of the page link
' strTableAttributes = a string of HTML
' table attributes i.e. "name=myTable bgCo
' lor=steeleblue"
'
'Sample Call:
' createSortableList objConn,strSQL,
' "EmployeeID",3,"EmployeeID","employee_deta
' il.asp","border=1 bgcolor='#cccccc'"
'
'Notes:
'
' This is code for a dynamically created
' sortable, pageable HTML table, this
' is a pretty stripped down version. Real
' simple, just call the procedure where you
' want the table, pass it a connection
' object and a SQL string, it will create
' an ADO recordset and fill it into an HTML
' table, it will be fully pageable and
' sortable by clicking the column head. You can a
' also have the values in one column linkab le to
' another page,(example being you have
' an offer number and you click it to go to a
' details page)
' You input the records per page, default sort order,
' and the HTML tables attributes.
' This can be easily made to incorporate
' images for column heads and for navigation
' buttons(maybe i'll post that later if this get a
' good response) Please email me with any questions
'Programmer: Devin Garlit
' (dgarlit@hotmail.com) 4/25/01
Sub createSortableList(objConn,strSQL, strDefaultSort, _
intPageSize, strLinkedColumnName,strLink,strTableAttributes)
Dim RS,strSort, intCurrentPage, strPageName
Dim strTemp, field, strMoveFirst, strMoveNext
Dim strMovePrevious, strMoveLast
Dim i, intTotalPages, intCurrentRecord
Dim intTotalRecords
i = 0
strSort = request("sort"

intCurrentPage = request("page"

strPageName = Request.serverVariables("SCRIPT_NAME"
If strSort = "" then
StrSort = strDefaultSort
End if
if intCurrentPage = "" then
intCurrentPage = 1
end if
set RS = server.CreateObject("adodb.recordset"
if strSort <> "" Then strSQL = strSQL & _
" order by " & replace(strSort,"desc", _
" desc"
with RS
.CursorLocation=3
.Open strSQL, objConn,3 '3 is adOpenStatic
.PageSize = cint(intPageSize)
intTotalPages = .PageCount
intCurrentRecord = .AbsolutePosition
.AbsolutePage = intCurrentPage
intTotalRecords = .RecordCount
end with
Response.Write "<table " & strTableAttributes & " >" & vbcrlf
'table head
Response.Write "<tr>" & vbcrlf
'loop through the fields in the recordset
for each field in RS.Fields
Response.Write "<td>" & vbcrlf
'check the sort order, if its
'currently ascending, make the link
'descending
if instr(strSort, "desc"

then
Response.Write "<a href=" & strPageName _
& "?sort="& field.name & _
"&page=" & intCurrentPage & ">" & _
field.name & "</a>" & vbcrlf
else
Response.Write "<a href=" & _
strPageName & "?sort="& field.name _
&"desc&page=" & intCurrentPage & ">" _
& field.name & "</a>" & vbcrlf
end if
Response.Write "<td>" & vbcrlf
next
Response.Write "<tr>"
'records
for i = intCurrentRecord to RS.PageSize
'display from the current record to the pagesize
if not RS.eof then
Response.Write "<tr>" & vbcrlf
for each field in RS.Fields
Response.Write "<td>" & vbcrlf
if lcase(strLinkedColumnName) _
= lcase(field.name) then
Response.Write "<a href=" & strLink & "?sort=" _
& strSort &"&page=" & intCurrentPage & _
"&" & field.name & "=" & field.value & _
" >" & field.value & "</a>" & vbcrlf
else
Response.Write field.value
end if
Response.Write "<td>" & vbcrlf
next
Response.Write "<tr>" & vbcrlf
RS.MoveNext
end if
next
Response.Write "<table>" & vbcrlf
'page navigation
Select Case cint(intCurrentPage)
case cint(intTotalPages) 'if its the last page give only links to movefirst and move previous
strMoveFirst = "<a href=" & strPageName & _
"?sort="& strSort &"&page=1 >"& "First" &"</a>"
strMoveNext = ""
strMovePrevious = "<a href=" & strPageName & _
"?sort="& strSort & "&page=" & _
intCurrentPage - 1 & " >"& "Prev" &"</a>"
strMoveLast = ""
case 1 'if first page only move next and move last
strMoveFirst = ""
strMoveNext = "<a href=" & strPageName & _
"?sort="& strSort &"&page=" & _
intCurrentPage + 1 & " >"& "Next" &"</a>"
strMovePrevious = ""
strMoveLast = "<a href=" & strPageName _
& "sort="& strSort &"&page=" & _
intTotalPages & " >"& "Last" &"</a>"
case else
strMoveFirst = "<a href=" & strPageName & _
"?sort="& strSort & "&page=1 >First" &"</a>"
strMoveNext = "<a href=" & strPageName & _
"?sort="& strSort & "&page=" & _
intCurrentPage + 1 & " >"& "Next" &"</a>"
strMovePrevious = "<a href=" & strPageName & _
"?sort="& strSort & "&page=" & _
intCurrentPage - 1 & " >"& "Prev" &"</a>"
strMoveLast = "<a href=" & strPageName & _
"?sort="& strSort &"&page=" & _
intTotalPages & " >"& "Last" &"</a>"
end select
With Response
.Write strMoveFirst & " "
.Write strMovePrevious
.Write " " & intCurrentPage & " of " & intTotalPages & " "
.Write strMoveNext & " "
.Write strMoveLast
end with
if RS.State = &H00000001 then 'its open
RS.Close
end if
set RS = nothing
end sub
%>
Regards
Niraj
![[noevil] [noevil] [noevil]](/data/assets/smilies/noevil.gif)