Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2007 - getting every nth record from a query

Posted on 2009-03-30
2
Medium Priority
?
498 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 500 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

722 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