Solved

Export first 100 records from a table into Excel

Posted on 2008-10-07
3
239 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
  • 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 92

Accepted Solution

by:
Patrick Matthews earned 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 - Labels prompt to print 4 31
Normalization of a table 19 74
unable to create table-based data macro in MS ACCESS 2013 11 25
IIF help, YN field 7 22
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
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.
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 …
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…

773 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