?
Solved

Export first 100 records from a table into Excel

Posted on 2008-10-07
3
Medium Priority
?
253 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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