Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Importing text to Access via VB ADO data control

Posted on 2000-04-03
1
Medium Priority
?
161 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 100 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
Suggested Courses

610 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