O'Reilly logo

Beginning Access™ 2007 VBA by Denise Gosnell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required