Solved

Import text (ASCII) file into access 97 from VB5

Posted on 1998-06-30
3
217 Views
Last Modified: 2012-06-27
How can I import a Text (ASCII) file into my Access 97 table
using VB 5.0.
0
Comment
Question by:rhnguyen
3 Comments
 
LVL 4

Expert Comment

by:tomook
ID: 1464625
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
 
LVL 18

Expert Comment

by:deighton
ID: 1464626
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
 
LVL 9

Accepted Solution

by:
cymbolic earned 50 total points
ID: 1464627
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question