By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

how to export bulk of datas from a sql pass through query to an excel file???

P: 13
hi ,
i want to export datas from a sql pass through query to an excel file. i tried this query
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputQuery, "Q_3_Monthly_LC", acFormatXLS, txt, False
but it is not working. here Q_3_Monthly_LC is a sql pass through query and txt contains file path.
Oct 4 '12 #1
Share this Question
Share on Google+
4 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,031
Are there more than 16,000 records? This may be causing your problem.

What kind of error are you receiving?
Oct 4 '12 #2

P: 13
i am getting the below error number and error message

2306,there are two many rows to output,based on the limitation specified
Oct 4 '12 #3

twinnyfo
Expert Mod 2.5K+
P: 3,031
In earlier versions of Excel, this method is limited to about 16,000 rows of output. You must use acFormatXLSX as the argument, and use the proper file name (and have the proper version of Excel, too!).

Hope this helps.
Oct 4 '12 #4

zmbd
Expert Mod 5K+
P: 5,285
Harinath88:
Is this is the same issue you had in:
http://bytes.com/topic/access/answer...ery-excel-file

If so, please do not double post... I'll leave this thread open for now; however, as I pointed out in the other thread... pass-thru queries do just that... by pass the jet/access control; therefore, with large record sets you will have alot of issues.
The only workaround is to pull the records into an Access table and then export that table.
You will have to also verify that the datatypes are acceptable to Excel or the transfer will puke.
Oct 4 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.