I have the following code to attempt to attach Azure SQL tables to Access front end. I get the "Could not find installable ISAM error". I have researched extensively and can't find what I'm doing wrong. This code works perfectly with an older Access database
2010 I think.
The purpose for me trying to link my tables directly and bypassing the DSN file is to try and increase the speed. The database currently doesn't have that much data but one form takes nearly 2 minutes to open now. The form was based on a 'one table' query
with criteria on one field only. In SQL we wrote several views to reduce the output in size but this has not made any difference to the speed. I am now setting the recordsource of the form with code on the OnLoad event. Once I've analysed which 'view' I
need I'm then assigning that view to the recordsource. Still no improvement in speed. So now I'm trying to attach tables directly rather than through ODBC. Any other suggestions would be appreciated.
I know the connection string is OK - it works in passthrough queries. but I'm wondering about the ODBC Driver 13 for Server.
I have to admit that this is beyond my ability.
These are the references I have active:
This is the code I'm using:
=================
Function AttachTable(stLocalTableName As String, stRemoteTableName As String)
On Error GoTo AttachTable_Err
Dim td As TableDef
Dim stConnect As String
For Each td In CurrentDb.TableDefs
If td.Name = stLocalTableName Then
CurrentDb.TableDefs.Delete stLocalTableName
End If
Next
stConnect = "DRIVER={ODBC Driver 13 for SQL Server};Server=tcp:xxxxxxdb.database.windows.net,1433;Database=xxxxx;Uid=brain@xxxxxxxxdb;Pwd=xxxxxxxx;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30; "
Set td = CurrentDb.CreateTableDef(stLocalTableName, dbAttachSavePWD, stRemoteTableName, stConnect)
CurrentDb.TableDefs.Append td
AttachTable = True
Exit Function
AttachTable_Err:
AttachTable = False
MsgBox "AttachTable encountered an unexpected error: " & Err.Number & ": " & Err.Description
End Function
Sub Relink_Tables()
On Error GoTo Relink_Error
Relink_One_Table "dbo_MyTableName", "MyTableName"
MsgBox "Tables Relinked"
Exit Sub
Relink_Error:
MsgBox "Error in linking " & Err.Number & ": " & Err.Description
End Sub
Sub Relink_One_Table(stAccessTable As String, stSQLTable As String)
AttachTable stAccessTable, stSQLTable
End Sub
Many thanks in advance for any help.
SG