Can you specify a sheet name in the DoCmd.OutputTo command when trying to export multiple reports to multiple sheets in the same excel file? If yes, what is the syntax?

Sponsored Links:

Related Topics

DoCmd.OutputTo AcFormatPDF
I'm trying to use DoCmd.OutputTo to save a report as a PDF file. The trouble I'm having is that it seems to ignore the formatting set in VBA. In this case if a certain condition is true thePageHeader is hidden, the problem is that DoCmd.OutputTo prints that header even if the condition is true.

Is there a way around it? Am I missing something?

Filter a report in DoCmd.OutputTo
How do you filter a report you use in

DoCmd.OutputTo acOutputReport, "reportName", .

I can filter a report in DoCmd.OpenReport

DoCmd.OpenReport "reportName", acViewNormal, , "[fieldname]=" & "whatever"

The DoCmd.OutputTo doc says that if you leave the Objectname parameter blank it will use the active object. Is there a way to make the report I want to use the active object, filter it then call DoCmd.OutputTo ?

Docmd.Outputto not working
I am trying to create a image from an Access report. This report has a chart on it. My Docmd.Outputto code doesn't seem to work right. I've tried

DoCmd.OutputTo acOutputReport, "rptNode", acFormatRTF, "C:\My Documents\rptNode.rtf"

DoCmd.OutputTo acOutputReport, "rptNode", acFormatHTML, "C:\My Documents\rptNode.htm"

and the results are empty. Can you see anything obviously wrong with my code? I am a newbie with Docmd.Outputto.

I have attached mock-up database with this problem in it. The 2 statements above are included preceded by Stop's. Click on the button. These statements are supposed to create an image with rptNode on it. (I only need one.) Do they work for you? You may need to change the file path.

outputto challenge
In VBA I'm trying to export 2 reports of my dbase as snapshots to a folder where users have access to.

The code I use:

DoCmd.OutputTo acOutputReport, "whatever", acFormatSNP, "T:\whatever.snp"
DoCmd.OutputTo acOutputReport, "whatever_1", acFormatSNP, "T:\whatever_1.snp"

The problem is that the second outputto never runs.
It only executes the first one, not the second.

However when I put this code in a button script it does work.

My problem is that I do not want to press a button to achieve this, the reports should automatically be saved as snapshots each time the dbase is run.

Has anyone have the same problem with docmd.outputto.&gt

docmd.outputto messages
Has anyone had any success suppressing the "now outputting" dialog boxes you get with docmd.outputto

I have got close, but the best I can do is to flick up what looks like an empty dialog box, which immediately disappears.

from 2005! is there any way to do this that can be incorporated into VBA?

docmd.transferspreadsheet crashes access
I am having some trouble with the docmd.transferspreadsheet function, everytime I run it, it crashes Access. I have used the docmd.outputto function and that works fine but I need the queries to be in the same excel file but in different sheet and the docmd.outputto open a new excel file for each query.


I have tried to display an error message but Access just freezes and I get the program not responding message |

DoCmd.OutputTo, 2007 - 2000
I have some code, working in Access 2007.
I want it to work in Access 2000 also.

The export from a table works fine:
DoCmd.OutputTo acOutputTable, "Data", acFormatXLS, , -1

The export from a query does work in Access 2007 but not in Access 2000:
DoCmd.OutputTo acOutputQuery, "Temp_N_Code", acFormatXLS

Creating PDFs with Docmd.OutputTo
When printing reports directly to PDFs using "Docmd.OutputTo" some lines (inside graphics) appear dashed. When the report is opened and printed to Adobe PDF or when the report is queued directly to a printer, the lines are not dashed.

(I even tried opening the report first and then using the option within "Docmd.OutputTo" to print the active object, but tono avail.)

Attached is an image of two graphics- the left image does not show any dashed effect, while the right one does. The effect is much more pronounced when printed.

I use DoCmd.OpenReport and the Load event code gets executed. But if I use DoCmd.OutputTo, the Load event does not fire. I want that Load code to fire when I output the report without opening it.

Supressing .pdf creation in acOutputTo
I am using VBA in Access 2007 and have the following code on a button in a stand alone form (form isn't tied to any data);

DoCmd.OutputTo acOutputReport, "rpt25+Anes", acFormatPDF, "Z:\Erx\Anes25+.pdf", False
DoCmd.OutputTo acOutputReport, "rpt25+Barb", acFormatPDF, "Z:\Erx\Barb25+.pdf", False
DoCmd.OutputTo acOutputReport, "rpt25+CUH", acFormatPDF, "Z:\Erx\CUH25+.pdf", False

The code works fine, the problem is that the second report, "rpt25+Barb" doesn't have any data yet. So I wind up creating a .pdf for my admin to send out that is empty. I create these reports every month.

Down the road that second report will have some data at some point and so I want to have that report ready to go when that does happen.

Now is there a way to check to see if the second report has data and if not, jump to the next OutputTo? If the second report does have data, follow thorough with the OutputTo command.

I have tried playing with HasData property,

DoCmd.OpenReport with a Filter??
From eRed the Noobe :-)

I have a report that I am trying to save as a PDF using DoCmd.OutputTo

This code properly saves the report:

DoCmd.OutputTo acOutputReport, "LTCFarNF", acFormatPDF, "M:\ARMGR\Reports\" & Me.ltcfname.Value & Chr(34) & ".pdf", True

However, I need to filter the report. The code below properly lets me preview the report:

DoCmd.OpenReport "LTCFarNF", acViewPreview, , "[LTCFarNF].[ltcfname]=" & Chr(34) & Me.ltcfname.Value & Chr(34)

How can I apply the filter/where to the DoCmd.OutputTo

DoCmd.OutputTo results are blank
so there I was.

No really, I'm trying to send the content of a form to an external file using VBA. I'm pretty sure that the OutPutTo method is the proper way to do it but I can't seem to get it right. The code below will execute and the file is properly formatted. The only problem is that it is blank. I've tried several different formats (Excel, RTF, Text.) and I get the same with all of them. It appears to execute fine but the results file is blank. Any idea what I'm doing wrong here? Interestingly, I can open the form and export it directly to a PDF file and it looks great.

DoCmd.OutputTo acOutputForm, "frmStatusByCatFinal", acFormatXLS, strPath, True

OutputTo Action vs Method
I have to create an Excel spreadsheet from an Access table using a macro. The filename is constructed from textbox values in a form. In a custom function, I use DoCmd.OutputTo and specify acFormatXLS as the OutputFormat. But the resultant spreadsheet is an older version of Excel. I need the Excel 97-2003 format. This can be specified in the OutputTo action, but not in the method. Is there a way to generate the correct version

OutputTo Options
I am building a button to export reports to an excel spreadsheet. I know how to use the OutputTo with variables to save a file to a specific place.

DoCmd.OutputTo acOutputReport, stDocName, acFormatXLS, stDocPath, False

But they want the ability to specify the directory location, kind of like when you do a file save as and then select where you want the file to go.
Other than putting a prompt in for them to type in the path/file name, what other options would allow them to specify the location and name of the file?

Report Hangs when using acCmdAppMinimize
I have a couple report buttons; features in a split (i.e., multi-user) application.

One button pushes a report out in PDF (to a location chosen by the users) another pushes the report to a specific SharePoint library in PDF format. They both work fine.until. I use: DoCmd.RunCommand acCmdAppMinimize

If I use this command to minimize the database window. then whenever I attempt to use the [DoCmd.OutputTo acOutputReport, "", acFormatPDF,.] Access just hangs.

I have even tried using DoCmd.RunCommand acCmdAppMaximize at the onset of the click procedure which kicks off the OutputTo acOutputReport, but to no avail.

However, when I take away the DoCmd.RunCommand acCmdAppMinimize when the app loads, the acOutputReport works fine.

I really need to have the DoCmd.RunCommand acCmdAppMinimize working.

Exporting pivot table
is there vba code to obtain the same result that Export to Excel button on ribbon/toolbar access menu?
I tried to use DoCmd.OutputTo command but only data refer to recordsource control
was export in excel file.
I mean there is a difference between the action that the "Export to Excel" execute from the action that
execute the use of DoCmd.OutPutTo

Exporting pivot table
Is there vba code to obtain the same result that “Export to Excel” button on ribbon/toolbar access menu? I tried to use DoCmd.OutputTo command but only data refer to recordsource control was export in excel file. I mean there is a difference between the action that the "Export to Excel" execute from the action that execute the use of DoCmd.OutPutTo

OutputTo: Report to Excel gives "The format in which you are attempting..."
OS: Windows XP SP3, Office 2007 Enterprise with SP2 (12.0.6557.50001) SP2 MSO(12.0.6544.5001). When using DoCmd.OutputTo and attempting to output a report to Excel, I get the following error:

The format to which you are attempting to output the current object is not available.

1) DoCmd.OutputTo acOutputReport, strSource, acFormatXLSX, , False
where strSource is the name of the report.

Researching the error seems to indicate that outputting a report to Excel will only work if SP2 is installed, but I do have SP2 installed.

DoCmd.OutputTo acOutputReport
How come I'm prompted to specify the output file type when the following code is executed?

DoCmd.OutputTo acOutputReport, "PDF-DirNames", acFormatPDF, IPPath & "\PDF-DirNames.PDF", True

It might be that the code is compiled into an A2003 mde file but executed in an A2007 environment?

outputting to PDF, needs a WHERE
to Bob, my program works perfectly.

Now, rather than sending the reports to the printer, I want to save them as PDFs. I'm generating hundreds of these, so I need to specify the filename of the PDF.

I need to turn this:

DoCmd.OpenReport "myReport", acViewPreview, , "[CclientID] =" & stJustOne, acDialog

Into this:

DoCmd.OutputTo acOutputReport, "myReport", acFormatPDF,

Problem is, there is no place for the WHERE.

Without the WHERE, instead of printing hundreds of individual PDFs, it prints everything in one giant PDF, hundreds of times.

How can I trade OutputTo for OpenReport