Linked Tables - Storing username in WSID variable

D

Don

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 WDID 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
 
T

TC

I don't know much about SQL*Server connect strings - but the rest of
the code looks fine, to me.

Try creating one linked table /manually/. Get it the way that you want
it, then you'll know what to do to the code. It seems to me that the
code is an unnecessary added complication at this stage.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top