Results 1 to 9 of 9

Thread: Navigate through a recordset using Previous and Next buttons

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Question Navigate through a recordset using Previous and Next buttons

    I am working with two asp pages, Page1.asp and Page2.asp

    On page1.asp I have a listbox... when I select an item it will POST the value to Page2.asp...

    The value is then passed into a query:

    sql = "SELECT * FROM Table1 WHERE Number = " & Record
    oRS.Open sql, oConn,1,3

    With this data it populates the text boxes... this work perfectly...


    I want to be able to Navigate through the recordset I queried by using a Next and a Previous button while populating the text boxes with the new values...


    I am using an Access 2000 database.....

    Can anyone help me out?

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    See this exapmle form microsoft.
    Attached Files Attached Files

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513
    Thank you amitabh.. This example is good if you want to SELECT * ... then when you click the Next button the next record is displayed..

    My problem is on Page1.asp, when I select an item from the list.. it takes this value and POSTS it to the server...

    When Page2.asp loads up it takes this value and sticks it into the sql query...

    I understand that I must select a range rather than one record... obviously if you click on Next there is no record because in the query it selected only one record...


    My question is , is there a way to select * and display the recordset at a ceratin record rather than the begiining of the recordset...


    Example:

    Page1.asp I click on John, the is brings the value "John" and a record number associated to this record to Page2.asp...

    I execute the query with something like this, SELECT * FROM TABLE1 WHERE Name = "John" and Date=#01/01/01#

    This will give me all the records for John on that date, this is a step further then selecting only one record...

    Now the thing is I want to populate the text boxes starting at the record number that I brought over for John and that date...


    Normally if I have

    Record1 John 01/01/01
    Record2 John 01/01/01
    Record3 John 01/01/01


    The text boxes will be populated with Record1, I want to the text boxes to be populated with the Record number that was brought over from Page1.asp.... record2


    I am running out of time...

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I am not getting the correct meaning of your qustion, but you can try "AbsolutePosition" property of the recordset. I will take a second look at the question to see if I get a clearer view.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513
    Lets say I select * FROM TABLE1 WHERE LastName = "John" and Date = #01/01/01#


    This will take evrything with the LastName John on that date...

    Lets say there are 10 records that result in this query..

    The results are:

    Record1 Smith
    Record2 Smith
    Record3 Smith...

    I want the text boxes to be populated with a specific record of my choice, for example Record2.... the records related to record2 will be populated in the text boxes and when I click Next it will populate the text box with record3

  6. #6
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I want the text boxes to be populated with a specific record of my choice, for example Record2.... the records related to record2 will be populated in the text boxes
    I think you would not have problem reaching till this stage.

    and when I click Next it will populate the text box with record3
    Use AbsolutePosition property of the recordset to point the cursor of your recordset to this position.

    This is assuming that you want to work within the same recordset.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513
    Lets say mt query results come up as:

    Record1
    Record2
    Record3
    Record5
    Record4

    How would it know to take record 5 when it is in the forth position?

  8. #8
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    I think it was you who was looking for this:
    Attached Files Attached Files

  9. #9
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    1) Sort the results.
    2) If you want a specific record based on something other than the name, use that in the where clause as well.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

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



Click Here to Expand Forum to Full Width