Hi all,
I have some tables in with SQL-server authentication.
I would like to refresh all linked tables after a user change his password. I have tried with;
Dim gStrConnect As String
Dim tdf As TableDefs
Dim db As Database
gStrConnect = "ODBC;DRIVER={SQL SERVER};SERVER=MyServer;Database=MyDb;UID=" & Me.strUserId & ";PWD=" & Me.strPwd
For Each tdf In db.TableDefs
If InStr(1, tdf.Connect, "MyDb") > 0 Then
With tdf
.Connect = gStrConnect
.RefreshLink
End With
End If
Next
When I run the above I get: 'Object is needed'
on row 'For Each tdf In db.TableDefs'.
I guess I need to open the database with something:
Set db = OpenDatabase(CurrentDb)
What do I have to do?
Kent J.
I have some tables in with SQL-server authentication.
I would like to refresh all linked tables after a user change his password. I have tried with;
Dim gStrConnect As String
Dim tdf As TableDefs
Dim db As Database
gStrConnect = "ODBC;DRIVER={SQL SERVER};SERVER=MyServer;Database=MyDb;UID=" & Me.strUserId & ";PWD=" & Me.strPwd
For Each tdf In db.TableDefs
If InStr(1, tdf.Connect, "MyDb") > 0 Then
With tdf
.Connect = gStrConnect
.RefreshLink
End With
End If
Next
When I run the above I get: 'Object is needed'
on row 'For Each tdf In db.TableDefs'.
I guess I need to open the database with something:
Set db = OpenDatabase(CurrentDb)
What do I have to do?
Kent J.