Solved

EXPORT REPORT TO EXCEL

Posted on 2003-11-12
5
5,769 Views
Last Modified: 2011-08-18
To export an Orders report to Excel, I use:
DoCmd.OutputTo acOutputReport, "report_ORDERS", acFormatXLS, "C:\ORDERS.xls".

When I open the Excel file I get the error message: "REPAIRS TO ORDERS.XLS"

In the error log, it logged "Renamed invalid sheet name"

What should the sheet name be, or is there an extra formatting routine required?

John
0
Comment
Question by:jjjtuohy
  • 3
  • 2
5 Comments
 
LVL 32

Expert Comment

by:jadedata
ID: 9732372
In a default built book this should be "Sheet1", "Sheet2" and "Sheet3"

The fact that you are outputting a report format to a spreadsheet might be part of the problem.
Normally you would output a table or query.
0
 
LVL 3

Author Comment

by:jjjtuohy
ID: 9732573
That's a clean result Jack; I output the underlying query and used acOutputQuery. I'll use that in future.

The technical puzzle still stands though:
(1) The Output-Object-Type list does include acOutputReport.
(2) The original report data did correctly export to Excel. Excel only moaned about having to rename an invalid sheet name to "Recovered-Sheet 1".
John
0
 
LVL 32

Accepted Solution

by:
jadedata earned 125 total points
ID: 9732659
Just because you CAN do a thing, doesn't mean you SHOULD do a thing....

To keep your excel output looking pretty, investigate the use of CopyFromRecordset.  I have found this method to be the BEST way to build new, or fill templated XLS worksheets from a pre-built query.  It is used against an Excel Object, which exposes all the properties and methods of Excel during the operation for things like adding a summary total row across the top of a worksheet, a custom column header row, using the autofilters and autofit methods to really "spank" the book into the shape I want to see it in.
0
 
LVL 3

Author Comment

by:jjjtuohy
ID: 9732801
Jack,
That was a Eureka moment! I didn't think of extracting from the outside. I'm assuming that a DAO database cannot be accessed externally without password.
On a side note I'm puting up 300 on a separate question "Suppress Conflict Viewer" and hope that you can help.
Cheers,
J
0
 
LVL 32

Expert Comment

by:jadedata
ID: 9732840
thanx for the question!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now