Hello, I have an access application that uses Linked tables to connect to a SQL Server using SQL Server authentication. I'm trying to store the user
name somewhere so it will show up in the process section of SQL Server. I'm trying to stored it in the WSID(Workstation ID?) but when I relink though
code it doesn't take the name. Is this not possible? Or can you store it somewhere else?
This is the content that I store in SQLCONNECTSTRING
ODBC;DRIVER={SQL SERVER};SERVER=TestSQL;AppName=TestApp;DATABASE=Data_TEST;
WSID=WorkstationA;UID=testuser;PWD=pwdtest;
Then I use the code below to create the link, but when I look in the system table the WSID is blank.
Thanks
Don
Dim td as TableDef
'Cycle through all tables that should be attached and create linked tables
sSQL = "select * from lstTables ORDER BY TableName"
Set rs = MyDB.OpenRecordset(sSQL)
Do Until rs.EOF
Debug.Print "Add " & rs!TableName
Set td = MyDB.CreateTableDef(rs!TableName)
td.Connect = SQLCONNECTSTRING
td.SourceTableName = rs!TableName
td.Attributes = dbAttachSavePWD
MyDB.TableDefs.Append td
If Not IsNull(rs!UniqueIdentifiers) Then
'debug.print rs!TableName
sSQL = "CREATE UNIQUE INDEX PK_" & rs!TableName & " on " &
rs!TableName & "(" & rs!UniqueIdentifiers & ")"
MyDB.Execute sSQL
End If
rs.MoveNext
Loop
name somewhere so it will show up in the process section of SQL Server. I'm trying to stored it in the WSID(Workstation ID?) but when I relink though
code it doesn't take the name. Is this not possible? Or can you store it somewhere else?
This is the content that I store in SQLCONNECTSTRING
ODBC;DRIVER={SQL SERVER};SERVER=TestSQL;AppName=TestApp;DATABASE=Data_TEST;
WSID=WorkstationA;UID=testuser;PWD=pwdtest;
Then I use the code below to create the link, but when I look in the system table the WSID is blank.
Thanks
Don
Dim td as TableDef
'Cycle through all tables that should be attached and create linked tables
sSQL = "select * from lstTables ORDER BY TableName"
Set rs = MyDB.OpenRecordset(sSQL)
Do Until rs.EOF
Debug.Print "Add " & rs!TableName
Set td = MyDB.CreateTableDef(rs!TableName)
td.Connect = SQLCONNECTSTRING
td.SourceTableName = rs!TableName
td.Attributes = dbAttachSavePWD
MyDB.TableDefs.Append td
If Not IsNull(rs!UniqueIdentifiers) Then
'debug.print rs!TableName
sSQL = "CREATE UNIQUE INDEX PK_" & rs!TableName & " on " &
rs!TableName & "(" & rs!UniqueIdentifiers & ")"
MyDB.Execute sSQL
End If
rs.MoveNext
Loop