Skipping First Few Records In A Recordset

quietpisces used Ask the Experts™
Hi, a function I've come across a few times that I found would be handy is in creating a recordset that skips the first, say, five records.  The reason for this is in a news page, for example, where the top 5 news stories will appear in full then a listing of the next twenty or so with less info down the side of this, all clickable to a detail page.  What is the best way to tweak Dreamweaver MX's code in terms of the repeat region or recordset to do this, so that the longer listing doesn't display the 5 records already displayed in the more detailed area of the page?  I've tried a few different things in terms of altering various values in DWMX's coding and the closest i got was when it worked but backwards - that is, the larger area skipped the first five, not the smaller area.  (This was using a single recordset and allowing the repeat region to count through say ten records first then another five).  I take it the best way is to somehow alter the recordset or the paging of the recordset so that it starts further along the records?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If you already have the recordset, then why can't you just call Recordset.MoveNext 5 times?


Because i didn't know that was an option, hence the reason for asking the question ... :)  I'll give it a try
There is a faster way!

use the recordset.move

easy to use...


recordset.move 5
do until recodset.EOF
   'your loop here


this is fun too if you want to iterate backwards through a recordset.


recordset.move -3


if you put that in a loop it will jump 3 at a time backwards

If you are really getting into ASP i would HIGHLY HIGHLY HIGHLY recomend the 'Wrox Programmer's Reference to ASP3.0' or .NET... they have both.

Best of Luck,

Benny B.
I stand corrected MPDeveloper :-) You learn something every day eh?

Meanwhile, just a small warning about going backwards in a recordset. If you want to do this, you have to make sure you get the right kind of recordset in the first place. Recordsets that can go backwards are generally less efficient, so normally you specify one that only goes forwards - unless, of course, you want to go backwards.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial