Hello !
I have linked tables over an ODBC-Connection to an SQL-Server 2000.
The problem is, when I link the tables to Access 2000 it is NOT using the set keys (primary keys) in SQL Server 2000 but the ROWGUID-column (used for replication by SQL-Server).
If I remove the replication (and the ROWGUID-column), Access uses my set keys, but I am updating the linked tables regularly and I NEED the replication running.
By linking the tables MANUALLY, I can choose the key by hand, but HOW can I set the key via VBA ??? Here is the code I'm using to link the tables:
Dim dbs As DAO.Database
Dim tdfLinked As DAO.TableDef
Set dbs = CurrentDb
For Each tdfLinked In dbs.TableDefs
If (tdfLinked.Attributes And dbAttachedODBC) Then
tdfLinked.Connect="ODBC;DSN=MYDSN;DATABASE=MYDATABASE"
tdfLinked.RefreshLink
End If
Next tdfLinked
How can I tell Access the key it SHOULD use ?
Thanks in advance,
Jens K.
I have linked tables over an ODBC-Connection to an SQL-Server 2000.
The problem is, when I link the tables to Access 2000 it is NOT using the set keys (primary keys) in SQL Server 2000 but the ROWGUID-column (used for replication by SQL-Server).
If I remove the replication (and the ROWGUID-column), Access uses my set keys, but I am updating the linked tables regularly and I NEED the replication running.
By linking the tables MANUALLY, I can choose the key by hand, but HOW can I set the key via VBA ??? Here is the code I'm using to link the tables:
Dim dbs As DAO.Database
Dim tdfLinked As DAO.TableDef
Set dbs = CurrentDb
For Each tdfLinked In dbs.TableDefs
If (tdfLinked.Attributes And dbAttachedODBC) Then
tdfLinked.Connect="ODBC;DSN=MYDSN;DATABASE=MYDATABASE"
tdfLinked.RefreshLink
End If
Next tdfLinked
How can I tell Access the key it SHOULD use ?
Thanks in advance,
Jens K.