I've updated the code with the suggestion given below, which I've tested and works great, for quick reference for future users.
I'm using the below code to create linked tables without having to set up a DSN for each user, how can I specify a primary key as you would be asked if connecting manually:
Dim sConnect As String
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
Set tdf = db.CreateTableDef
tdf.Name = "dbo_vwFeedback" ' - -- --- This is the Label that you see in Access...
tdf.Connect = "ODBC;DRIVER=SQL Server;SERVER=server01\serverinstance;DATABASE=db_name;Trusted_Connection=Yes"
tdf.SourceTableName = "vwFeedback" ' - -- --- This is the actual name in SQL Server, minus the owner.
db.TableDefs.Append tdf
CurrentDb.Execute "CREATE UNIQUE INDEX PK_dbo_vwFeedback_PrimaryKey ON dbo_vwFeedback (DataSetID, FeedbackRef) WITH PRIMARY"
NOTE: The above is for a SQL Server VIEW, it is identical for a SQL Server TABLE, but you do not need the CurrentDB.Execute
line (if your primary key is correctly set up on the Server).
The code is in the place of linking a table and specifying a primary key manually.
If you do not specifying the creation of an index for SQL Server VIEWs manually or with the above method, you will only get a READ ONLY view and you may experience erroneous data returned, see comments below for examples.