• 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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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