LIMIT UNDER 5000 EXPORT TO EXCEL

  • Thread starter Thread starter JVANDERBEEk
  • Start date Start date
J

JVANDERBEEk

I need to figure out a way that i can limit the number of
records to under 5000. After that i will need to create
multiple exports if greater than 5000. Ideas?
 
The first part is a piece of cake: just use a select query
to export from, and set the Top values property to 5000.

Multiple exports is where it starts to get tricky... how
do you instruct a query to select records 5001 to 10000
and so on?
Well, if you do it through VB (which I assume you do), and
your export recordset is sorted on a primary key:
- use the Top Values > 5000 property in your query
- open the query as a recordset, go to the last record and
read the PK's value, before going to the next one
- to do the next export add a WHERE PK > (value read)
clause in the query, so as to get the next 5000 records

and so on...

HTH,
Nikos
 
Back
Top