MS Access - Select top 30 then next 30 etc

JohnMac328
JohnMac328 used Ask the Experts™
on
I need to select the top 30 records in an MS Access table. Then the next 30 etc. I am used to SQL tables.  What would the syntax be?  Here is what I have now

SELECT TOP (30) FROM Directory_List

Many thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
remove the parenthesis...

SELECT TOP 30 something FROM Directory_List
Top Expert 2016

Commented:


how many times will this be done?
if twice

select top 30 * from Directory_list

then

select top 30 * from Directory_list
where id not in (
select top 30 Id from Directory_list)

Author

Commented:
Already did that - I get the first 30 - I need the next 30 and so on.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Top Expert 2016

Commented:
<I need the next 30 and so on.>

you will need to use VBA to do that?

what do you intend to do withe results of the query?

Author

Commented:
capricorn1

Three times, total of 90 records I need to span on the page

Author

Commented:
I am using cold fusion on the front end.  I just need three query's to select the three columns for a printout on a page
Top Expert 2016
Commented:
the third query will be

select top 30 * from Directory_list
where id not in (
select top 60 Id from Directory_list)

Author

Commented:
Great thanks
Top Expert 2006

Commented:
can you keep a copy of the old id when you generate this sql?
initially initialised to zero then it would be something like this

select top 30 * from directory_list
where id >= <your variable here>
order by id

once you retrieve the records, id would be set to the last record id

Top Expert 2006

Commented:
so what if you had more than 90 or the number varies? it might not happen now but may do in the future

Author

Commented:
This portion

where id not in (
select top 60 Id from Directory_list)

will list records not in the first 60 - any after 60

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial