Solved

Access 2007 - getting every nth record from a query

Posted on 2009-03-30
2
483 Views
Last Modified: 2012-05-06
I have a query with many conditions that returns 332 records (at this time.)  I can use DCOUNT to count the number of records and then I divide that by 15, and the rounded number I get is 22.  I now want to only show (or extract to another query) every 22nd record.  I am having trouble with this seemingly easy part.

If I could get a field in the query that was simply the record #, I could then take only the records where the record # /22 is an integer.  There are other ways as well, I'm sure.  Maybe lack of sleep is preventin me from seeing this.  Help would be greatly appreciated.
0
Comment
Question by:pmpatane
  • 2
2 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 125 total points
ID: 24024315
Well ... IF ... you added the Auto Number to the underlying table AND if ... it can remain sequential with no gaps - then you could use the Mod function on that as a criteria to only display

[YourAutoNumberFieldName] Mod 22 = 0

mx
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 125 total points
ID: 24024330
Here is a generic example:

SELECT tblEmp.*
FROM tblEmp
WHERE ((([EmpID] Mod 22=0)=True));

Again however ... this would depend on your auto number remain sequential ... which may not be practical in your case ?

mx
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question