Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub LinkOracleTable(Server, UserID, Password, Schema, TableName)
- Dim tbl As New ADOX.Table
- Dim cat As New ADOX.Catalog
- Set cat.ActiveConnection = CurrentProject.Connection
- With tbl
- .Name = TableName
- Set .ParentCatalog = cat
- .Properties("Jet OLEDB:Create Link") = True
- .Properties("Jet OLEDB:Link Provider String") = "ODBC;" & _
- "Driver={Microsoft ODBC For Oracle};" & _
- "Server=" & Server & ";" & _
- "Uid=" & UserID & ";" & _
- "Pwd=" & Password & ";"
- .Properties("Jet OLEDB:Cache Link Name/Password") = True
- .Properties("Jet OLEDB:Remote Table Name") = Schema & "." & TableName
- End With
- cat.Tables.Append tbl
- cat.ActiveConnection.Close
- End Sub
- LinkOracleTable "TNS Service Name", "UserName", "Password", "MySchema", "MyTable"
Add Comment
Please, Sign In to add comment