Solved

VB.net Excel Add-in manipulating text files via Access

Posted on 2013-12-04
4
343 Views
Last Modified: 2013-12-04
Hi

I am using the following VB.net code to link an Access table to a text file
so that I can run a query on the data. I want to be able to automatically
do this with different text files coming from different database sources.
Is this technique reliable?

  Dim appAccess As New Microsoft.Office.Interop.Access.Application
        appAccess.OpenCurrentDatabase("C:\Users\murbro\Documents\Database1.accdb")
        appAccess.Visible = True

        'Link to a csv file so that it acts as a table in Access
        appAccess.DoCmd.TransferText(TransferType:=Microsoft.Office.Interop.Access.AcTextTransferType.acLinkDelim, TableName:="tblImport", _
    FileName:="C:\Users\murbro\Documents\MyData.txt", HasFieldNames:=True)
0
Comment
Question by:murbro
  • 2
  • 2
4 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
yes, just change this part

 FileName:="C:\Users\murbro\Documents\MyData.txt"

to connect to the other text file.

if you will use the same table "TableName:="tblImport""

make sure to delete the table before linking
0
 

Author Comment

by:murbro
Comment Utility
Thanks. Does that mean that I don't have to use import specifications.

Thanks
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
No, Import Spec is for Importing not for Linking files.
0
 

Author Comment

by:murbro
Comment Utility
Great. Thanks very much
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

10 Experts available now in Live!

Get 1:1 Help Now