Solved

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

Posted on 2013-12-04
4
348 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39696662
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
ID: 39696682
Thanks. Does that mean that I don't have to use import specifications.

Thanks
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39696792
No, Import Spec is for Importing not for Linking files.
0
 

Author Comment

by:murbro
ID: 39697445
Great. Thanks very much
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

828 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