OutputTo Macro Action

You can use the OutputTo action to output the data in the specified Microsoft Office Access 2007 database object (a datasheet, form, report, module, or data access page) to several output formats.

Settings

The OutputTo action has the following arguments.

Action argument

Description

Object Type

The type of object containing the data to output. Click Table (for a table datasheet), Query (for a query datasheet), Form (for a form or form datasheet), Report, Module, Server View, Stored Procedure, or Function in the Object Type box in the Action Arguments section of the Macro Builder pane. You can't output a macro. If you want to output the active object, select its type with this argument, but leave the Object Name argument blank. This is a required argument. The default is Table.

Object Name

The name of the object containing the data to output. The Object Name box shows all objects in the database of the type selected by the Object Type argument.

If you run a macro containing the OutputTo action in a library database, Access first looks for the object with this name in the library database, and then in the current database.

Output Format

The type of format you want to use to output the data. You can select Excel 97 - Excel 2003 Workbook (*.xls), Excel Binary Workbook (*.xlsb), Excel Workbook (*.xlsx), HTML (*.htm; *.html), Microsoft Excel 5.0/95 Workbook (*.xls), PDF Format (*.pdf), Rich Text Format (*.rtf), Text Files (*.txt), or XPS Format (*.xps). If you leave this argument blank, Access prompts you for the output format.

Note   You can export to a PDF or XPS format file from Office Access 2007 only after you install the add-in. For more information, seeEnable support for other file formats, such as PDF and XPS.

Output File

The file to which you want to output the data, including the full path. You can include the standard file name extension for the output format you select with the Output Format argument, but it is not required. If you leave the Output File argument blank, Access prompts you for an output file name.

Auto Start

Specifies whether you want the appropriate software to start immediately after the OutputTo action runs, with the file specified by the Output File argument opened.

Template File

The path and file name of a file you want to use as a template for HTML files. The template file is a text file that includes HTML tags and tokens that are unique to Access.

Encoding

The type of character encoding format you want used to output the text or HTML data. You can select MS-DOS, Unicode, or Unicode (UTF-8). The MS-DOS argument setting is available only for text files. If you leave this argument blank, Access outputs the data by using the Windows default encoding for text files and the default system encoding for HTML files.

Output Quality

Select Print to optimize the output for printing, or Screen to optimize the output for display on a screen.

Remarks

The Access data is output in the selected format and can be read by any program that uses the same format. For example, you can output an Access report with its formatting to a Rich Text Format document and then open the document in Microsoft Office Word 2007.

If you output the database object to HTML format, Access creates a file in HTML format containing the data from the object. You can use the Template File argument to specify a file to be used as a template for the .html file.

The following rules apply when you use the OutputTo action to output a database object to any of the output formats:

  • You can output data in table, query, and form datasheets. In the output file, all fields in the datasheet appear as they do in Access, with the exception of fields containing OLE objects. The columns for OLE object fields are included in the output file, but the fields are blank.

  • For a control that is bound to a Yes/No field (a toggle button, option button, or check box), the output file displays the value –1 (Yes) or 0 (No).

  • For a text box bound to a Hyperlink field, the output file displays the hyperlink for all output formats with the exception of MS-DOS text (in this case, the hyperlink is displayed as normal text).

  • If you output the data in a form in Form view, the output file always contains the form's Datasheet view.

  • When you output a datasheet, form, or data access page in HTML format, one .html file is created. When you output a report in HTML format, one .html file is created for each page in the report.

The result of running the OutputTo action is similar to clicking one of the options in the Export group on the External Data tab. The action arguments correspond to the settings in the Export dialog box.

To run the OutputTo action in a Visual Basic for Applications (VBA) module, use the OutputTo method of the DoCmd object.

Applies To: Access 2007



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language