Navigating through a large number of records

Results 1 to 2 of 2

Thread: Navigating through a large number of records

  1. #1
    Join Date
    Dec 1969

    Default Navigating through a large number of records

    Okay, here&#039;s the scenario...A user performs a query on an Access DSN, we process it and return the first page of x number of results...Paging through these large sections is very easy, however, once the user selects one of these records, I&#039;d like to be able to offer forward/backward navigation relative to the current record they&#039;re The main query returns 500 records, they page through 20 records at a time and eventually select the 5th record on the 3rd page (relative to this query,it&#039;s record #45 (20+20+5), however, in the database it may be RecordID#1742)...<BR><BR>My question is on the most efficient way to maintain this index of record numbers so that the user can select "Previous record" which would take them to record #44 (relative to the current query) and show them database RecordID #512...<BR><BR>My first thought is that I&#039;d have to read through every record returned by the query and build an index array (RelativeRecordNum, RecordID) which would then be carried around in a session variable...This method has a whole list of problems associated with it and I&#039;m sure there must be a better way to do this...Any Thoughts/Suggestions?<BR><BR>Thanks in advance..<BR><BR>Mike

  2. #2
    Join Date
    Dec 1969

    Default How about...

    ... remembering the query that produced the output. You could carry that along as the WHERE clause, perhaps, in a hidden form field:<BR><BR>&#060;INPUT Type=Hidden Name=SQLWhere Value="&#060;% = SQL %&#062;" &#062;<BR><BR>You may have to encode it if it contains a " character, of course.<BR><BR>*ALSO* carry along the record ID of the current record in a hidden field.<BR><BR>Finally, use PRIOR and NEXT submit buttons.<BR><BR>Then you can do:<BR><BR>&#060;%<BR>...<BR>query = "SELECT * FROM table WHERE " & Request("SQLWhere") <BR><BR>If Request("Submit") = "PRIOR" Then<BR>&nbsp; &nbsp; query = query & " AND RecordID &#060; " & Request("RecordID")<BR>ElseIf Request("Submit") = "NEXT" Then<BR>&nbsp; &nbsp; query = query & " AND RecordID &#062; " & Request("RecordID")<BR>Else<BR>&nbsp; &nbsp; ... oops?...<BR>End If<BR>...<BR>%&#062;<BR><BR>Sneaky enough?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts