Solved

Import text (ASCII) file into access 97 from VB5

Posted on 1998-06-30
3
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

695 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