Solved

Importing text to Access via VB ADO data control

Posted on 2000-04-03
1
143 Views
Last Modified: 2010-05-02
I have an ASCII Text file, 7 fields.  I need to import to an MS Access table.  This  will happen weekly, the old data must be deleted in the Access table.  I wish to do this using Visual Basic 6.0 and the ADO data control.  Can anyone help out with the code.

I am just learning Visual Basic, so I need some help.

Thanks in Advance.
0
Comment
Question by:brabo
1 Comment
 
LVL 1

Accepted Solution

by:
ariell earned 50 total points
ID: 4372602
1. add a reference to MSACC8.OLB
2. strFileName will specify the path\file etc. to import
3. if it doesn't work i have somthing more efficient. mail me ariell@clal-ins.co.il

Public Sub CreateAccessFile()
 
  Dim objAccess As New Access.Application
 
  If Len(Dir(strFileName)) Then Kill (strFileName)
  objAccess.Visible = False
  objAccess.NewCurrentDatabase strFileName
  objAccess.DoCmd.TransferText , , "Table1", FileName, True
 
  Set objAccess = Nothing
 
  Kill (strTempFileName)
 
End Sub
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now