Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Query
Nathan Maturine 
   
4 years ago
I need a query to exclude the first 7 records in the results.
This is the Access SQL I tried, but its not returning anything.
SELECT RiskItems.strPolicyNumber, RiskItems.curRiskItemValue, RiskItems.lngRiskItemRate, RiskItems.strRiskItemType, RiskItems.curRiskItemPremium, RiskItems.strPolicyNumber
FROM RiskItems
WHERE (((RiskItems.strPolicyNumber)=[Forms]![frmPropertyRenewalPopUp]![fldPolicyNumber]) AND ((RiskItems.strPolicyNumber) Not In (SELECT TOP 7 RiskItems.strPolicyNumber From RiskItems )));


I am pulling the policy number from a form that's opened.
Alex Hedley  @Reply  
           
4 years ago
EXCEPT

Example
SELECT column_name1, column_name2, ...
FROM table_name1
EXCEPT
SELECT column_name1, column_name2, ...
FROM table_name2;
Nathan Maturine OP  @Reply  
   
4 years ago
Hi, Thanks for the response, but i'm not sure i follow the logic. I do not know of a way to identify the first 7 records that should be excluded.
Richard Rost  @Reply  
          
4 years ago
Might need an ORDER BY in there, Alex.
Nathan Maturine OP  @Reply  
   
4 years ago
Also, Alex, are you suggesting to copy data to a second table?
Alex Hedley  @Reply  
           
4 years ago
The example was just the syntax of how to use EXCEPT
Is just SET Theory.
Alex Hedley  @Reply  
           
4 years ago
Alternate example
SELECT *
FROM myTable x
WHERE x.ID NOT IN (SELECT Top 10 id FROM myTable ORDER BY ....)
ORDER BY ...
Kevin Yip  @Reply  
     
4 years ago
Hi Nathan, the top 7 records in the first part of the query are not the same top 7 records in the second part because one has the WHERE condition and the other doesn't.  The second part of the query should be:

    SELECT TOP 7 RiskItems.strPolicyNumber From RiskItems
    WHERE RiskItems.strPolicyNumber=[Forms]![frmPropertyRenewalPopUp]![fldPolicyNumber]


They have to have matching WHERE conditions.
Kevin Yip  @Reply  
     
4 years ago
And of course if the WHERE condition results in few than 7 records you won't see anything.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 6:33:44 PM. PLT: 0s