Paging in access

Results 1 to 2 of 2

Thread: Paging in access

  1. #1
    Join Date
    Dec 1969

    Default Paging in access

    I have an access database. I have about 2000 items in the db split into 6 categories. I would like to show a list of 20 items per page and then show the next 20 on the next page etc. etc. The problem I am running into is because I am showing one category at a time, the item numbers are not continuous. I need a way to get all the record numbers from the database in a particular category and then split them somehow into groups of 20. A friend told me he does it with a stored procedure in SQL. However, I'm stuck with access. Is there a way?

  2. #2
    Join Date
    Dec 1969

    Default RE: Paging in access

    You can bring back the entire recordset and use ADO&#039;s paging properties: PageSize, PageCount, and AbsolutePage. These are properties of the recordset.<BR><BR>First set rs.PageSize to the required number: 20 in your case. rs.PageCount will now tell you the number of pages (surprise!).<BR>Setting the AbsolutePage property will move the recordset&#039;s position to the first record on that page. Now you can loop through until you&#039;re no longer on that page.<BR><BR>eg<BR><BR>rs.PageCount = 20<BR>rs.AbsolutePage = iPageNum<BR>do until rs.eof or rs.AbsolutePage &#062; iPageNum <BR> &#039;write out the data as usual<BR> rs.MoveNext<BR>loop<BR><BR>hope this helps!

Posting Permissions

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