Question : Access VBA - exporting a table into a text file of a different format

Hi

I have a table in Access. Some of the data has to be exported to a text file in a different format so that it can be imported by another database. What is the best way to go about this. Do I create a query to get to the other format required for input?

Answer : Access VBA - exporting a table into a text file of a different format

Source:  MS Access Help - Search OutputTo Method


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

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.

Parameters

Name Required/Optional Data Type Description
ObjectType Required AcOutputObjectType An AcOutputObjectType constant that specifies the type of object to output.
ObjectName Optional Variant A 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.
OutputFormat Optional Variant An AcFormat constant that specifies the output format. If you omit this argument, Access prompts you for the output format.
OutputFile Optional Variant A 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.
AutoStart Optional Variant Use True (1) to start the appropriate Microsoft Windowsbased 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.
TemplateFile Optional Variant A 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.
Encoding Optional Variant The type of character encoding format you want used to output the text or HTML data.  
OutputQuality Optional AcExportQuality An AcExportQuality constant that specifies the type of output device to optimize for. The default value is acExportQualityPrint.

Enjoy!
Random Solutions  
 
programming4us programming4us