Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linking SQL Server tables via VBA in Access 2010 generates error

Posted on 2014-10-18
2
Medium Priority
?
635 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

705 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