Solved

Linking SQL Server tables via VBA in Access 2010 generates error

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

This collection of functions covers all the normal rounding methods of just about any numeric value.
I have a large data set and a SSIS package. How can I load this file in multi threading?
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

920 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

15 Experts available now in Live!

Get 1:1 Help Now