List Box Show first 10

  • Thread starter Thread starter meyerryang
  • Start date Start date
M

meyerryang

I want a list box to show the first 10 records from a query. Any ideas how
to do that?

I tried created an autonumber up to 10 and taking anything < 11, but the
query takes about 15 minutes to run. I am looking for a query that takes the
first 10 and is very smooth and fast. Thanks.
 
Okay - I found an easy answer. Thank you Jeff Boyce:

"First" is a squishy concept. What you think of as "first" may not
(probably does not) match what Access considered "first".

Your first step will be to order the data (use a query).

Then, you can use one of the query properties (TOP) to return only the
"first" 10 result rows.
 
Set the Rowsource property for the list box to return TOP n records?

see help Top Predicate (in Access97) may need to experiment a bit with
whatever version you are using.

e.g SELECT TOP 10 colum1, column4, columnwhatever
FROM aTableOrQuery
[WHERE whatever]
ORDER BY whatever

There are circumstances where > 10 rowsare returned
For example in a query I just created:
SELECT TOP 10 qAccName, Town
FROM qAccountsWithAltNames
ORDER BY Town DESC;

29 records are returned - because there are a quite a few accounts in York!

Jim Bunton
 
Back
Top