DoCmd.OutputTo

Output the data held in an Access database object (datasheet, form, report, module, data access page) to several output formats.

Syntax
      DoCmd.OutputTo(ObjectType, ObjectName, OutputFormat,
                        OutputFile, AutoStart, TemplateFile,
                            Encoding, OutputQuality)

Key
   ObjectType    An AcOutputObjectType constant that specifies
                 the type of object to output.

   ObjectName    The name of an object of the type selected by
                 the ObjectType argument.
                 To output the active object, specify the object
                 type and leave this argument blank.

   OutputFormat  An AcFormat constant that specifies the output format.

   OutputFile    The full pathname of the file to output the object to.
                 If left blank, Access will prompts for an filename.

   AutoStart     Use True (-1) to start the appropriate application
                 and immediately load the output file.
                 Use False (0) to just export the file.

   TemplateFile  A string expression that's the full pathname of
                 a file to use as a template for an HTML, HTX, or
                 ASP output file.

   Encoding      The type of character encoding format to use to
                 output the text or HTML data. 

   OutputQuality  A constant that specifies the type of output 
                 device to optimize for. acExportQualityPrint (0)
                 or acExportQualityScreen (1).

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.

Microsoft Internet Information Server and Microsoft ActiveX Server formats are available only for the Object Types: tables, queries, and forms.

Examples

'Output the tblPatients table as .RTF
DoCmd.OutputTo acOutputTable, "tblPatients", acFormatRTF, "patients.rtf", True

“An Asian can't help but love China and take pride in it. China doesn't export tanks and men. It exports dignity and respect” ~ Norodom Sihanouk

Related

TransferText - Import or export data to/from a text file.


 
Copyright © 1999-2024 SS64.com
Some rights reserved