Solved

Linking SQL Server tables via VBA in Access 2010 generates error

Posted on 2014-10-18
2
628 Views
Last Modified: 2014-10-18
I am attempting to link SQL Server 2012 tables in my Access 2010 database running in 2003 mode via vba. I get the following error:
Could not find installable ISAM.

The code I am using is:

Sub LinkTables(sTbl As String)
    Dim db As DAO.Database
    Dim tdf As DAO.TableDef
   
    Set db = CurrentDb()
    Set tdf = db.CreateTableDef(sTbl)
    tdf.SourceTableName = sTbl
    db.TableDefs.Delete sTbl
    tdf.Connect = sConnect
   
    db.TableDefs.Append tdf
    db.TableDefs.Refresh
   
    Set tdf = Nothing
    Set db = Nothing
End Sub
0
Comment
Question by:pabrann
2 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 40388797
a. You have the Office object lib referenced correct?
b. Your app compiles fine, correct?
c. What does your connect string look like?

 #3 being the problem most likely.  Access determines the type of source it's linking to by using that (it should be starting with "ODBC;").

The error your getting seems to indicate that it's trying to link the wrong type of DB.

 To see what the string should look like, link to the SQL table manually through the Access interface, then check the tables .connect property from the debug window:

Debug.Print CurrentDB().tableDefs("mylinkedtablename").Connect

Jim.
0
 

Author Closing Comment

by:pabrann
ID: 40388823
Thanks so much Jim, you have done it again!!!! Wonderful.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Viewers will learn how the fundamental information of how to create a table.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

820 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