Solved

Importing text to Access via VB ADO data control

Posted on 2000-04-03
1
153 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
[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
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

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 While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

717 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