Is there a way to refresh the link to an Oracle Tale from withing VBA Code when a password is required? I have code that will walk though and refresh other links to MDB databases, but have not been able to get to work with the Oracle Tables.
This is the code that I am using to refresh the link. Will not work unless I have done the manual link first, then it runs like a charm. How do I get this to work the first time????
Error returned is:
Run Time Error 3151
ODBC--connection to 'Artsql' failed
This is the code that I am using to refresh the link. Will not work unless I have done the manual link first, then it runs like a charm. How do I get this to work the first time????
Error returned is:
Run Time Error 3151
ODBC--connection to 'Artsql' failed
Code:
Dim CurDB As Database, tdfLinked As TableDef
Set CurDB = CurrentDb()
For Each tdfLinked In CurDB.TableDefs
If tdfLinked.Attributes And dbAttachedODBC Then
If Len(tdfLinked.Connect) > 0 Then
tdfLinked.Connect = "ODBC;DSN=ArtSql;SERVER=twdbp;DATABASE=;pwd=twbrio"
tdfLinked.RefreshLink
End If
End If
Next tdfLinked
Set CurDB = Nothing