Table of contents
Collapse the table of content
Expand the table of content

DoCmd.OutputTo Method (Access)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

The OutputTo method carries out the OutputTo action in Visual Basic.


expression. OutputTo( ** ObjectType, ** ObjectName, ** OutputFormat, ** OutputFile, ** AutoStart, ** TemplateFile, ** Encoding, ** OutputQuality )

expression A variable that represents a DoCmd object.


NameRequired/OptionalData TypeDescription
ObjectTypeRequiredAcOutputObjectTypeAn AcOutputObjectType constant that specifies the type of object to output.
ObjectNameOptionalVariantA string expression that's the valid name of an object of the type selected by the ObjectType argument. If you want to output the active object, specify the object's type for the ObjectType argument and leave this argument blank. If you run Visual Basic code containing the OutputTo method in a library database, Microsoft Office Access searches for the object with this name, first in the library database, then in the current database.
OutputFormatOptionalVariantAn AcFormat constant that specifies the output format. If you omit this argument, Access prompts you for the output format.
OutputFileOptionalVariantA string expression that's the full name, including the path, of the file you want to output the object to. If you leave this argument blank, Access prompts you for an output file name.
AutoStartOptionalVariantUse True (?1) to start the appropriate Microsoft Windows?based application immediately, with the file specified by the OutputFile argument loaded. Use False (0) if you don't want to start the application. This argument is ignored for Microsoft Internet Information Server (.htx, .idc) files and Microsoft ActiveX Server (.asp) files. If you leave this argument blank, the default ( **False* ) is assumed.
TemplateFileOptionalVariantA string expression that's the full name, including the path, of the file you want to use as a template for an HTML, HTX, or ASP file.
EncodingOptionalVariantThe type of character encoding format you want used to output the text or HTML data.
OutputQualityOptionalAcExportQualityAn AcExportQuality constant that specifies the type of output device to optimize for. The default value is acExportQualityPrint.


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

Modules can be output only in MS-DOS Text format, so if you specify acOutputModule for the ObjectType argument, you must specify acFormatTXT for the OutputFormat argument. Microsoft Internet Information Server and Microsoft ActiveX Server formats are available only for tables, queries, and forms, so if you specify acFormatIIS or acFormatASP for the OutputFormat argument, you must specify acOutputTable, acOutputQuery, or acOutputForm for the ObjectType argument.

The Access data is output in the selected format and can be read by any application 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 Word.

Note You can save as a PDF or XPS file from a 2007 Microsoft Office system program only after you install an add-in. For more information, search for "Enable support for other file formats, such as PDF and XPS" on the Office Web site.


The following code example outputs the Employees table in rich-text format (.rtf) to the Employee.rtf file and immediately opens the file in Microsoft Word for Windows.

DoCmd.OutputTo acOutputTable, "Employees", _ 
 acFormatRTF, "Employee.rtf", True

See also


DoCmd Object

© 2017 Microsoft