Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Flat Ascii Text File

Status
Not open for further replies.

precious5

Programmer
Aug 22, 2001
13
US
Hi,
I'm new to VB. I need to take a flat text file and append it to my Access 2000 database. I have not been able to find any help with importing a flat text file. I'm not really sure where to even begin with my code. Any help or pointers would be greatly appreciated. Thanks!
 
Can you give me a little more infomation on the DoCommand, please.
 
Here ya go...just replace with your file name

DoCmd.TransferText acExportDelim, "Standard Output", _
"External Report", "C:\Txtfiles\April.doc"

(If you need more help here is a copy of the info from the help file:

The TransferText method carries out the TransferText action in Visual Basic. For more information on how the action and its arguments work, see the action topic.

Syntax

DoCmd.TransferText [transfertype][, specificationname], tablename, filename[, hasfieldnames][, HTMLtablename]

The TransferText method has the following arguments.

Argument Description
transfertype One of the following intrinsic constants:
acExportDelim
acExportFixed
acExportHTML
acExportMerge
acImportDelim (default)
acImportFixed
acImportHTML
acLinkDelim
acLinkFixed
acLinkHTML
If you leave this argument blank, the default constant
(acImportDelim) is assumed.
Note You can link to data in a text file or HTML file, but this data is read-only in Microsoft Access.
specificationname A string expression that's the name of an import or export specification you've created and saved in the current database.
This argument is required for fixed-width text files. For delimited text files and Microsoft Word mail merge data files, you can leave this argument blank to select the default import/export specifications.
tablename A string expression that's the name of the Microsoft Access table you want to import text data to, export text data from, or link text data to, or the Microsoft Access select query whose results you want to export to a text file.
filename A string expression that's the full name, including the path, of the text file you want to import from, export to, or link 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. If you leave this argument blank, the default (False) is assumed.
This argument is ignored for Microsoft Word mail merge data files, which must always contain the field names in the first row.
HTMLtablename A string expression that's the name of the table or list in the HTML file that you want to import or link. This argument is ignored unless the transfertype argument is set to acImportHTML or acLinkHTML. If you leave this argument 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 a <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, Microsoft Access distinguishes them by adding a number to the end of each table or list name; for example, Employees1 and Employees2.)

Hope this helps you...
Tammy,Indiana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top