Solved

Importing text to Access via VB ADO data control

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

759 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

21 Experts available now in Live!

Get 1:1 Help Now