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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import to access through VB

Status
Not open for further replies.

ktwclark

Programmer
Jan 30, 2002
54
0
0
GB
I have an access database with and import specification already defined. I'm looking to import a text file using the specification through a VB front-end.

The Access code is:

Docmd.TransferText acImportDelim, "ABC Import Specification", "ABC", "C:\Reports"

which imports the text file called ABC.txt from C:\Reports using the pre-programmed import specification called ABC Import Specification".

How do I do this using ADO?

Once I import the file I have no problems running other queries pre-programmed in the database through VB.

I'm just having a prblem importing the data in the first place!

Any help would be appreciated.
 
Does ABC.txt hold comma seperated values?
Are you trying to get the data from the file into a DB.

If so, you can use the file inoyt method to get data from the file.

dim str as string
Open "ABC.txt" for Input as #1

Input #1,str

Close #1

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
The simplest thing is to create an Access.Application object and open the database with it. Then use its DoCmd object exactly the same way you do it in VBA.

This way you are guaranteed the correct results. Otherwise you will have to read in and parse the text file and write out each record yourself taking account of the file specification details
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top