?
Solved

How to link a SQL SERVER table to access?

Posted on 2001-09-03
7
Medium Priority
?
205 Views
Last Modified: 2008-07-03
On my project I linked an access table from one access DB to another using ADOX. Now I wanted to link a table from SQL SERVER to ACCESS DB. Can anybody help me on how to handle this?

Thanks
0
Comment
Question by:revathi
[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
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:dekeldate
ID: 6451705
You could use something like this

I have used a DSN as the ODBC connection string to connect to the Pubs sample database on SQL Server.

Sub CreateLinkSQL()

   dim strTargetDB As String, _
       strProviderString As String, _
       strSourceTbl As String, _
       strLinkTblName As String)

   strTargetDB = "C:\Program Files\Microsoft zffice\Office\Samples\Northwind.mdb"
   strProviderString = "ODBC;DSN=Publishers;UID=sa;PWD=;DATABASE=pubs;"
   strSourceTbl = "dbo.Authors"
   strLinkTblName = "LinkedODBC"

   Dim catDB As ADOX.Catalog
   Dim tblLink As ADOX.Table

   Set catDB = New ADOX.Catalog
   ' Open a Catalog on the database in which to create the link.
   catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
         "Data Source=" & strTargetDB

   Set tblLink = New ADOX.Table
   With tblLink
      ' Name the new Table and set its ParentCatalog property to the
      ' open Catalog to allow access to the Properties collection.
      .Name = strLinkTblAs
      Set .ParentCatalog = catDB

      ' Set the properties to create the link.
      .Properties("Jet OLEDB:Create Link") = True
      .Properties("Jet OLEDB:Link Provider String") = strProviderString
      .Properties("Jet OLEDB:Remote Table Name") = strLinkTbl
   End With

   ' Append the table to the Tables collection.
   catDB.Tables.Append tblLink

   Set catDB = Nothing
End Sub


hope this helps
0
 

Author Comment

by:revathi
ID: 6459601
Thank you expert!. While I am using 'Link provider string' property I am getting error stating 'Couldnot find installable ISAM' . I don't know the reason of this error. But if I use 'Link datasource' property I am not getting any such errors. Can you tell me why is this happening?
0
 
LVL 1

Accepted Solution

by:
dekeldate earned 800 total points
ID: 6459883
hi
This is probably because the path to the ISAM driver in your Windows Registry is invalid, or the ISAM driver does not exist.

check this kb article
http://support.microsoft.com/support/kb/articles/Q209/8/05.ASP
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:revathi
ID: 6466976
Thank you Expert!
0
 

Author Comment

by:revathi
ID: 6466977
Thank you Expert!
0
 

Author Comment

by:revathi
ID: 6466978
Thank you Expert!
0
 
LVL 1

Expert Comment

by:dekeldate
ID: 6468201
Thank you :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

764 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