K
Krish
Folks,
I have used the following code to link SQL Server tables in MSAccess using
ADO connection string. On my newly built XP machine I am getting this
dreadful error (-2147467259 (80004005) Could not find installable ISAM).
OS: Windows XP Svc PK 3
ADO version 2.8
Any help will be highly appreciated.
Krish.
LinkATable "Provider=SQLOLEDB.1;Password=%PWD%;User ID=%UID%;Initial
Catalog=%DBNAME%;Data Source=%SERVER%",
"sa","password","mytable","mytable","mydb"
Public Function LinkATable( _
sUID$, _
sPWD$, _
sSourceTable$, _
sLinkAs$, _
sDBName$, _
sConnstrTemplate$, _
Optional sDSN$ = "", _
Optional sDataSource$ = "", _
Optional sServer$ = "")
Dim oCat As Object
Dim oTable As Object
Dim sConnString$
sConnString = sConnstrTemplate
sConnString = Replace(sConnString, "%DSN%", sDSN)
sConnString = Replace(sConnString, "%UID%", sUID)
sConnString = Replace(sConnString, "%PWD%", sPWD)
sConnString = Replace(sConnString, "%DBNAME%", sDBName)
sConnString = Replace(sConnString, "%SERVER%", sServer)
' Create and open an ADOX connection to Access database
Set oCat = CreateObject("ADOX.Catalog")
Set oCat.ActiveConnection = CurrentProject.Connection
' Create a new Table object
Set oTable = CreateObject("ADOX.Table")
With oTable
.Name = sLinkAs
Set .ParentCatalog = oCat
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Remote Table Name") = sSourceTable
.Properties("Jet OLEDB:Link Provider String") = sConnString
.Properties("Jet OLEDB:Cache Link Name/Password") = True
.Properties("Jet OLEDB:Link Datasource") = sDataSource
End With
' Add Table object to database
oCat.Tables.Append oTable ' GIVES THE ERROR
oCat.Tables.Refresh
Set oCat = Nothing
End Function
I have used the following code to link SQL Server tables in MSAccess using
ADO connection string. On my newly built XP machine I am getting this
dreadful error (-2147467259 (80004005) Could not find installable ISAM).
OS: Windows XP Svc PK 3
ADO version 2.8
Any help will be highly appreciated.
Krish.
LinkATable "Provider=SQLOLEDB.1;Password=%PWD%;User ID=%UID%;Initial
Catalog=%DBNAME%;Data Source=%SERVER%",
"sa","password","mytable","mytable","mydb"
Public Function LinkATable( _
sUID$, _
sPWD$, _
sSourceTable$, _
sLinkAs$, _
sDBName$, _
sConnstrTemplate$, _
Optional sDSN$ = "", _
Optional sDataSource$ = "", _
Optional sServer$ = "")
Dim oCat As Object
Dim oTable As Object
Dim sConnString$
sConnString = sConnstrTemplate
sConnString = Replace(sConnString, "%DSN%", sDSN)
sConnString = Replace(sConnString, "%UID%", sUID)
sConnString = Replace(sConnString, "%PWD%", sPWD)
sConnString = Replace(sConnString, "%DBNAME%", sDBName)
sConnString = Replace(sConnString, "%SERVER%", sServer)
' Create and open an ADOX connection to Access database
Set oCat = CreateObject("ADOX.Catalog")
Set oCat.ActiveConnection = CurrentProject.Connection
' Create a new Table object
Set oTable = CreateObject("ADOX.Table")
With oTable
.Name = sLinkAs
Set .ParentCatalog = oCat
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Remote Table Name") = sSourceTable
.Properties("Jet OLEDB:Link Provider String") = sConnString
.Properties("Jet OLEDB:Cache Link Name/Password") = True
.Properties("Jet OLEDB:Link Datasource") = sDataSource
End With
' Add Table object to database
oCat.Tables.Append oTable ' GIVES THE ERROR
oCat.Tables.Refresh
Set oCat = Nothing
End Function