Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select every nth record? (2003)

    Is there a way to select every nth (say, every 3rd, or 5th, or 8th, etc) record from a table using a query?

    The data are GPS positions, and I am using them to create an animation of vehicle motion. Selecting non-contiguous records allows me to speed up the animation. Presently I select every record in the base query, and then walk thru the resulting recordset using the recordset.MOVE N command in some VBA code. However this technique can miss significant records when more than one vehicle exists in the recordset. I figure that selecting the nth records prior to walking thru the recordset (and then displaying EVERY record from the query) would work better.

    thanks for any help.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select every nth record? (2003)

    If you have a sequential ID, you could use the mod function:

    every_nth:[id] mod 4

    set criteria to 1 to show records 1,5,9 etc

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select every nth record? (2003)

    Ah, yes. That will work. Thanks
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

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