Link to home
Start Free TrialLog in
Avatar of JohnMac328
JohnMac328Flag for United States of America

asked on

MS Access - Select top 30 then next 30 etc

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
Avatar of bigtwig
bigtwig

remove the parenthesis...

SELECT TOP 30 something FROM Directory_List
Avatar of Rey Obrero (Capricorn1)


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)
Avatar of JohnMac328

ASKER

Already did that - I get the first 30 - I need the next 30 and so on.
<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?
capricorn1

Three times, total of 90 records I need to span on the page
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
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great thanks
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

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

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

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