I have a module of code, in my Access 2000 db, that changes the connect string of the linked SQL Server database to be DSN-less. One problem though, some users are prompted for a user id and password, while others are not. Any reason why that might be? Here's the code
Function ChangeConnectString()
'This sample function changes the connect string of the linked SQL Server
'Events database to be DSN-less.
Dim db As Database
Dim t As TableDef
Set db = CurrentDb
For Each t In db.TableDefs
If t.Attributes And dbAttachedODBC
Then
t.connect = "driver={SQL Server};server=Transql;" & _
"database=Events;uid=events;pwd=events"
t.RefreshLink
End If
Next
db.Close
End Function
Function ChangeConnectString()
'This sample function changes the connect string of the linked SQL Server
'Events database to be DSN-less.
Dim db As Database
Dim t As TableDef
Set db = CurrentDb
For Each t In db.TableDefs
If t.Attributes And dbAttachedODBC
Then
t.connect = "driver={SQL Server};server=Transql;" & _
"database=Events;uid=events;pwd=events"
t.RefreshLink
End If
Next
db.Close
End Function