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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Link to Oracle Table from VBA

Status
Not open for further replies.

kkitt

Programmer
Dec 1, 2002
122
US

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.

Thanks
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top