Solved

Access 2007 - getting every nth record from a query

Posted on 2009-03-30
2
495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) 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 - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

632 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