9.2. Exporting Access Data to Web Formats

As you learned in Chapter 7, you have various ways to export data from Access to other formats. The OutputTo method allows exporting to various formats: HTML, RTF, TXT, XLS, and XLSB. The examples in this section will focus on a Web-centric example using HTML, but you could also use the OutputTo method to export to text files or other supported formats. Consult the Access Help documentation for additional information on these formats. The basic syntax for the OutputTo method is shown in the following code:

DoCmd.OutputTo ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding

Various parameters can specify how the method should execute. The following table explains the use of each parameter.

ParameterDescription
ObjectTypeType of object to be exported. See the help documentation for the complete list of objects.
ObjectNameName of the object being exported.
OutputFormatThe format to which the object should be exported.
OutputFileThe full name, including the path, of the file to which the object should be exported.
AutoStartIndication of whether the destination program is to start immediately. False is the default.
TemplateFileThe full name, including the path, of the file to use as a template.
EncodingThe type of character encoding format to use when outputting the text or HTML data.
OutputQualityType of output device to optimize for. The AcExportQuality constant specifies the type, and the default value is acExportQualityPrint. ...

Get Beginning Access™ 2007 VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.