Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Export first 100 records from a table into Excel

Posted on 2008-10-07
3
Medium Priority
?
261 Views
Last Modified: 2013-11-27
Hello,
I have created a table which is created from 2 append queries. I have indexed the table so field 'Total'
is in descending order. Will this stay in descending order all the time now?

My query is the table contains 22,000 entries and I only want the top 100 exported to Excel.
Is it possible to loop through the table to only paste the first 100 entries to Excel and forget
the rest?

Thanks
Ian
0
Comment
Question by:ShockUK
[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
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22658594
you can get the top 100  using a query
the order by will determine which 100  you want to get

select top 100 *
from TableX
order by [fieldName]
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 22658604
Ian,

Create the query below, and export the query to Excel:

SELECT TOP 100 *
FROM SomeTable
ORDER BY Total DESC

Always use an ORDER BY clause if you need your results ordered in some way, because there is nothing
magical in the way records are physical ordered in memory.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22658612
(Will this stay in descending order all the time now?)
may or may not, but that is irrelevant . You can always sort them using a query.
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

609 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