Solved

Linking SQL Server tables via VBA in Access 2010 generates error

Posted on 2014-10-18
2
627 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Some sers suddenly getting error popup msg 28 86
Run SQL Server Proc from Access 11 28
update all email addresses SQL 1 23
SQL Group on First occurrence 9 24
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!!!
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

813 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

14 Experts available now in Live!

Get 1:1 Help Now