Exporting Access Rpts to Excel

R

RFrechette

Hi All,

I have been trying to export an Access Rpt into Excel and I'm not having
much luck.
I need the formatting of the report as far as the grouping and sorting.

Here's the 3 options I've tried so far:

Sub OutputToExcel()

DoCmd.OutputTo ObjectType:=acOutputReport, _
ObjectName:="rpt_Main_Sheet", _
OutputFormat:=acFormatXLS, _
OutputFile:="C:\test.xls", _
AutoStart:=True

End Sub

-------------------------------------

Sub OutputToExcel()

DoCmd.OutputTo acOutputReport, _
"rpt_Main_Sheet", _
acFormatXLS, _
"C:\test.xls", _
True

End Sub

-------------------------------------

DoCmd.OutputTo acReport, "rpt_Main_Sheet", acFormatXLS, "C:\test.xls", True

-------------------------------------

For each one, I get the following error when I run it...

Run-Time Error 2001
You canceled the previous operation.

Can somebody please help me?

Thank you so much in advance.

R Frechette
 
K

Ken Snell \(MVP\)

How big is the report? OutputTo will only output about 16,339 rows of data
(the limit for EXCEL 95). Also, if there are no data to output, the output
action will be cancelled and that error also will occur.

Also be sure that there are no data errors in the report; that also will
cause an error (probably 3078), which also will cancel the report export.
 
R

RFrechette

Thank you for the help Ken.

Unfortunately, I've been assigned to work on something else for a while. I
will get back to this later.

Thanks again.

Rfrechette
 

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

Top