From: mmmbl on
Is there a way to turn the "Save Formatted" off in visual basice when
exporting to excel to prevent the "too many records" error? My query can be
exported using the file export but it does not when I use a button to export
the query.
From: Douglas J. Steele on
I doubt the "Save Formatted" is what's causing the "too many records" error.

Excel spreadsheets cannot handle more than 65,536 rows of data. If you're
trying to export rows than that, you'll get that error message.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"mmmbl" <mmmbl(a)discussions.microsoft.com> wrote in message
news:FDE495B2-5DD3-4AB5-B37F-5AB4D158DFE0(a)microsoft.com...
> Is there a way to turn the "Save Formatted" off in visual basice when
> exporting to excel to prevent the "too many records" error? My query can
> be
> exported using the file export but it does not when I use a button to
> export
> the query.


From: mmmbl on
It's only 27,777 records. The TransferSpreadsheet works but it keeps
overwriting the tabs. What I intend to do is export the spreadsheet with the
previous date as the tab name. So for yesterday records the tab should have
100306 as tab name, 100406 for tomorrow. What I'm trying to accomplish is
import a data file into access each day, work on the data, then the following
day append the current data and export previous day data. Here is the code
Dim varOldName As Variant
Dim varNewName As Variant
Dim varFilename As Variant
Dim varDir As Variant
varDir = Format(DATE, "yyyy")
varFilename = "i:\PRICING\DATABASE\ACCESS 2003\REPORT HISTORY\" & varDir
& "\EXCEPTION" & Format(DATE, "mmyyyy") & ".XLS"
varOldName = Format(DATE - 2, "mmddyy")
varNewName = Format(DATE - 1, "mmddyy")

'DoCmd.OutputTo acOutputQuery, varOldName, acFormatXLS, varFilename -
THis gives me the too many error

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, varOldName,
varFilename, True - This overwrites the current tab



DoCmd.Rename varNewName, acQuery, varOldName - this rename the old query
to todays date and used for the tab name when exporting.
"mmmbl" wrote:

> Is there a way to turn the "Save Formatted" off in visual basice when
> exporting to excel to prevent the "too many records" error? My query can be
> exported using the file export but it does not when I use a button to export
> the query.