Why can't you create an index for an ODBC source after the link?
At work, we use Access with SQL Server related tables, and when someone wants to connect to another database (moving from a production environment to a test environment), we do something similar for all tables:
Dim TD As TableDef Dim ConString As String ConString = "ODBC;DRIVER={SQL Server};SERVER=ServerName;DATABASE=DbName;Trusted_Connection=Yes;" CurrentDb.TableDefs.Delete "SomeTable" Set TD = CurrentDb.CreateTableDef("SomeTable", 0, "SomeTable", ConString) CurrentDb.TableDefs.Append TD Set TD = Nothing CurrentDb.Execute "CREATE UNIQUE INDEX SomeIndex ON SomeTable (PrimaryKeyColumn) WITH PRIMARY"
source share