<%dim crumb crumb="DoCmd TransferText" crumb1="Transfer Text DoCmd" %> DoCmd TransferText in Microsoft Access
Home  Fees/Services  Access Templates  Tutorials  Access Download  Articles  Search  Forums  Blockchain Tech  Contact  Privacy  Links

DoCmd Examples - Access VBA<%response.write "
" & crumb1 %>

Docmd Macro VBA Example
Developer Home > Access Database Tutorials > DoCmd Examples<% response.write " > " & crumb %>
<% dim Gnum,Ynum Gnum="3847865006" Ynum="7164" dim Page_Type Page_Type="Prog" %>

DoCmd AddMenu
DoCmd ApplyFilter
DoCmd CancelEvent
DoCmd Close
DoCmd CopyObject
DoCmd DeleteObject
DoCmd FindRecord
DoCmd FindNext
DoCmd GotoControl
DoCmd HourGlass
DoCmd Min/Max/Restore
DoCmd OpenForm
DoCmd OpenQuery
DoCmd OpenReport
DoCmd OutputTo
DoCmd RunSQL
DoCmd SendObject
DoCmd TransferDatabase
DoCmd TransferText

Create Export Specs


Microsoft Office:
  MS Access 2003
  Access 2007
  Access 2010
  Access 2013

Docmd.TransferText Action & Method Example

The TransferText method is used to import/export text between the current Access database or Access project and a text file located externally to your database. You can also use this command to link to data in a text file. Additionally, can import from, export to, and link to a table in an HTML file.  However, linking to text or HTML file data will result in a read only dataset.

The TransferText method has the following syntax and options:

DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage) Transfer Type is the type of transfer you want to perform. You can import, export, or link to data in text files or HTML files. You can also export data to an MS Word mail merge file.

Specification Name The specification name for the set of options that determines how a text file is imported, exported, or linked. For a fixed-width text file, you must either specify a specification name or use a schema.ini file, which should be stored in the same directory as the imported, linked, or exported text file.

To learn more about creating an export or import specification file see our detailed example titled Access Export Specification Wizard.

Table Name The name of the table to import text data to, export text data from, or link text data to.  You may also export data from a query.  Enter the query name in the table name option.

File Name (required) This is the name of the file to import from, export to, or link to.  Don't forget to specify the full path for the file.

New! Download a running example of the Docmd.TransferText method

Access will create a new file if non exists or will over write an existing file.

Note that if you want to import or link a particular table or list in an HTML file, you can use the HTML Table Name argument.

Has Field Names This option specifies whether the first row of the file contains the names of the data fields. If you select Yes, then Access uses the names in this row as field names in the Access imported/linked table.  If you select No, Access treats the first row as a normal row of data. The default value for this option is No.

Note that for Word mail merge data files this option is ignored because the first row must contain the field names.

HTML Table Name The name of a table or a list in the HTML file that you intend to import or link to. This argument is only used when the Transfer Type option is set to Import HTML or Link to HTML. The default for this field is to import the 1st table or list in the HTML file.

Note that you must use the <Caption> tag in the HTML file to name the table or list.

Code Page is the name of the character set used with the code page.

Microsoft Office:
MS Access 2003
Access 2007
Access 2010
Access 2013

Contact Information

<% Response.write "Copyright 2000-" & year(now) & " Blue Claw Database Design" %>