ODBCDirect Problem In Access 2007

N

Nicholas

I am trying to connect to oracle database and i've tried using Microsoft Jet
workspace and ODBCDirect workspace. Once i run the macro at microsoft office
2007 under windows vista and i get the error "Run time error '3847'
ODBCDirect
is no longer supproted. Rewrite the code to use ADO instead of DAO'".

My coding is as following.

Function PopulateListOfOdbcTableToLink(OdbcName As String, ByRef
ListOfTables As Collection) As Integer
Dim wrkJet As Workspace
Dim dbs As Connection
Dim tdf As TableDef
Dim Atable As Variant
Dim Rs As Recordset
Dim AllTablesSql As String
Dim rc As Variant
'
On Error GoTo PopulateListOfOdbcTableToLink
'
' Open Microsoft Jet Database object.
Set wrkJet = CreateWorkspace("MyWorkspace", _
"", "", dbUseODBC)
'
' Initialise the progress bar
'
rc = SysCmd(acSysCmdSetStatus, "Finding the Tables to link ... ")
DoEvents

Set dbs = wrkJet.OpenConnection(OdbcName)
'
' Populate the collection
'

AllTablesSql = "select OBJECT_NAME from all_objects " & _
"where owner like 'IDB%' and object_type in ('TABLE',
'VIEW')"
'
Set Rs = dbs.OpenRecordset(AllTablesSql)
While Not Rs.EOF
ListOfTables.Add Rs.Fields(0).Value
Rs.MoveNext
Wend
dbs.Close
'
' Clean the status bar
'
rc = SysCmd(acSysCmdClearStatus)
PopulateListOfOdbcTableToLink = 0
Exit Function
PopulateListOfOdbcTableToLink:
MsgBox "An error has occured : Wrong Odbc name given or invalid Oracle
user/password. You will not be able to configure the Idb until the Linking is
performed.", vbCritical
PopulateListOfOdbcTableToLink = 1
End Function


Can anyone point out what wrong with my coding and how to amend it? Many
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top