How Do I Traverse Backwards Thru An Access Database?

Results 1 to 5 of 5

Thread: How Do I Traverse Backwards Thru An Access Database?

  1. #1
    pnub Guest

    Default How Do I Traverse Backwards Thru An Access Database?

    How do I traverse backwards through an Access database? and display the contents of each entry along the way?<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: How Do I Traverse Backwards Thru An Access Database?

    Open a recordset with a cursor that allows backward movement (see http://www.4guysfromrolla.com/webtech/112998-1.shtml for more info):<BR><BR>Dim rs<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR>rs.Curso rType = adOpenStatic<BR>rs.Open "SELECT SomeColumn FROM MyTable", objConnection<BR><BR>rs.MoveLast<BR>While Not rs.BOF<BR> Response.Write rs("SomeColumn")<BR> rs.MovePres<BR>Wend<BR><BR>rs.Close<BR>Set rs = Nothing<BR><BR>This example doesn&#039t show connecting to the database (see http://www.4guysfromrolla.com/webtech/faq/Databases/faq2.shtml if you are unfamiliar with this), and must have ADOVBS.inc included (see http://www.4guysfromrolla.com/webtech/faq/Beginner/faq7.shtml if you don&#039t know what ADOVBS.inc is)<BR><BR>Happy Programming!

  3. #3
    pnub Guest

    Default RE: How Do I Traverse Backwards Thru An Access Database?

    I originally was using the following because I wasn&#039t able to travers backwards through my database and then I was going to change it to traverse forward.<BR><BR>&#060;%<BR> objRecordset.MoveFirst<BR> Do While Not objRecordset.EOF<BR> Response.Write objRecordset.Fields("name") & "<BR>" & vbCrLf<BR> Response.Write objRecordset.Fields("email") & "<BR>" & vbCrLf<BR> Response.Write objRecordset.Fields("message") & "<BR><BR>" & vbCrLf<BR> objRecordset.MoveNext<BR> Loop<BR> objRecordset.Close<BR> Set objRecordset = Nothing<BR>&#037;&#062;<BR><BR>Now, If I set the cursor using .MoveLast and changed EOF to BOF, but when I change .MoveNext to .MovePres I get an object not support error.

  4. #4
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: How Do I Traverse Backwards Thru An Access Database?

    You&#039ve got to open your recordset with a non forward-only cursor. Are you doing this?


  5. #5
    pnub Guest

    Default RE: How Do I Traverse Backwards Thru An Access Database?

    Which cursor should I use?

Posting Permissions

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