Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

Import text (ASCII) file into access 97 from VB5

How can I import a Text (ASCII) file into my Access 97 table
using VB 5.0.
0
rhnguyen
Asked:
rhnguyen
1 Solution
 
tomookCommented:
The short answer: write an import routine. To help you further we will need the format of the text file and the format of the table(s) you wish to populate.
0
 
deightonCommented:
You can read data in from your text file using

'open your data base here

Open "yourfile.txt" for input as #1
   line input #1,sLine

do until eof(1)
   ..
'''   chop your string up here using mid,left right etc

   rs.addnew

 '''  adn populate your database fields

     rs.update  

   line input #1,sLine

loop

close #1
0
 
cymbolicCommented:
Here's the easiest method.  Import the text file manually once, and save the import spec.  Then, you can either make a vba module invoked by a macro, or import using a macro command in MS Access.  You can them invoke the macro, which causes an automatic import via a command line parameter to MS Access.  If you need to cause this in VB, then you can use the Shell command to invoke Access and run the macro, or there are other API methods in addition to invoke Access and cause it to do the import for you.

In ms access, look up help for the docmd, and transfertext commands to get specifics and options.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now