Import or export data to/from a text file (Delimited, fixed width or HTML).
Syntax DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage) Key TransferType The type of transfer to make. AcTextTransferType SpecificationName The name of an import or export specification previously created and saved in the database. For a fixed-width text file, either specify an argument or use a schema.ini file, stored in the same folder as the imported, linked, or exported text file. (To create a schema file, use the text import/export wizard.) For delimited text files and Word mail merge files, you can leave this argument blank to select the default import/export specifications. TableName The full pathname, of the text file to import from, export to, or link to. FileName The full pathname of the file to output to. HasFieldNames Use True (-1) to use the first row of the text file as field names when importing, exporting, or linking. Use False (0) to treat the first row of the text file as normal data. This argument is ignored for Word mail merge data files, which must always contain the field names in the first row. HTMLTableName The name of the table or list in the HTML file to import or link. (string) This argument is ignored unless the TransferType argument is set to acImportHTML or acLinkHTML. If left blank, the first table or list in the HTML file is imported or linked. The name of the table or list in the HTML file is determined by the text specified by the <CAPTION> tag, If there's no <CAPTION> tag, the name is determined by the text specified by the <TITLE> tag. If more than one table or list has the same name, Access distinguishes them by adding a number to the end of each table or list name; for example, Employees1 and Employees2. CodePage A Long value indicating the character set of the code page.
Use TransferText to import or export text between the current Access database or Access project (.adp) and a text file. You can also link the data in a text file to the current Access database.
'Output the T_Patients table as a delimited text file
DoCmd.TransferText acExportDelim, "Standard Output", _
“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
OutputTo - Export to a Text/CSV/Spreadsheet file.