Export Query to multiple files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have an Access query that will return about 4 million records (lines in a
table). How can I export the results into seperate files? Lets say 80 .csv
files with 50,000 rows.

My code is:

Function BigQuery()
Dim path As String

path = AppPath & "BigQuery.csv"
On Error Resume Next
Kill path
On Error GoTo 0

DoCmd.TransferText acExportDelim, , "BigQuery", path, True
If Not NoWarning Then
MsgBox "The BigQuery csv file has been created in " & path
End If
End Function

Any help is appreciated.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You're talking about paging. If I was working in *nix I'd use the split
command:

split -linecount 50000 fileName

In Access you'll have to page using a Recordset. See this site for an
example of a paging class using VBA:

http://www.asp101.com/articles/thanh/pagingclass/default.asp

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/zrP4echKqOuFEgEQKRYQCfVN2rNXHQ4jQlTaPn6MLK167ruBkAn153
yutaAU98F2ouN3cxpY8eigzt
=hGJD
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top