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

Oracle 11g issue with VBA connection

Status
Not open for further replies.

rekrabnai

Technical User
Sep 28, 2000
32
GB
Hi all

I created some code (which has been used without issue time and again) to create linked tables to an Oracle 10g Database.
Recently one of our servers has been upgraded ro Oracle 11g and now my code will not work.

The code refers to a table 'OracleTables' to get the tablenames I wish to connect to

The code :

Dim rs As Recordset
Dim tdf As TableDef
Dim strConnect As String

strconnect="ODBC;Driver={Microsoft ODBC for Oracle};Server=MyDatabase;Uid=USERID;Pwd=PASSWORD"

DoCmd.Hourglass True
On Error GoTo err_routine
Set rs = CurrentDb().OpenRecordset("select * from OracleTables") 'This contains the Table Name (Tablename) and Owner (User)
Do While Not rs.EOF
If tableexists(rs!Tablename) Then
CurrentDb().TableDefs.Delete (rs!Tablename)
End If
'create link
Set tdf = CurrentDb().CreateTableDef(rs!Tablename)
tdf.Connect = strConnect
tdf.SourceTableName = rs!User & "." & rs!Tablename
CurrentDb().TableDefs.Append tdf
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set tdf = Nothing

When I execute the code on the 11g server I get the message :

'Unable to link to specified database'

for info, I am using Windows 7, MSAccess 2010 and the Microsoft ODBC for Oracle Driver is version 6.01.760117514

Any help is gratefully appreciated.

Sometimes if you want to put a nail in a piece of wood, you just gotta hit it with a hammer!!
 
Hi dhookom

Thanks for the reply.
If you are asking if I went into Administrative toos & ODBC administrator then yes.

I set both ODBC links to both the 10g and the 11g environment using the same userid and they both worked. This suggested to me that :

a) There were no rights issues on the 11g
b) The issue could be with the syntax of the connection string but looking into this I could not find anything.

Any ideas that I may try would be greatfully appreciated.

Sometimes if you want to put a nail in a piece of wood, you just gotta hit it with a hammer!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top