Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linked Tables - Storing username in WSID variable

Status
Not open for further replies.

DonS100

Programmer
Dec 4, 2001
104
0
0
US
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


 
Can you change over to windows authentication, then it would not be necessary to store the login name instead it would be available from a windows API.
 
I would prefer to keep the SQL Authentication for other reasons.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top