This discussion is archived
1 Reply Latest reply: May 22, 2012 6:02 AM by 936790 RSS

Error referencing the OraDatabase property of an Oracle Activex Control

936790 Newbie
Currently Being Moderated
I am looking for a way to use the OraDatabase property of an Oracle ActiveX Control to initialize an OraDatabase object.
The "Using Oracle Objects for OLE with Automation Clients" manual has the following instructions for setting up the Oracle ActiveX Control:

----------------------------------------------------------------------------

     'Set the username and password.
     OraDataControl.Connect = "scott/tiger"

     'Set the database name.
     OraDataControl.DatabaseName = "ExampleDb"

     'Set the record source.
     OraDataControl.RecordSource = "select * from emp"

     'Refresh the data control.
     OraDataControl.Refresh

     You now have a valid session, database, and dynaset that can be referenced as follows:
     
Object = Reference
orasession = oradatacontrol.oradatabase.orasession
oradatabase = oradatacontrol.oradatabase
oradynaset = oradatacontrol.recordset

----------------------------------------------------------------------------

I am working with an Access 2003 database connected to an Oracle 11g database. I have created a form and added an Oracle ActiveX Data Control (named 'OraDataControl') to it. I added the following code in VBA:

Private Sub SetOraDataControl(strSQL As String)
Dim dbo As OraDatabase
Dim strSQL As String
10 On Error GoTo ErrorHandler
20 With OraDataControl
30 .Connect = "+username/password+"
40 .DatabaseName = "+db-connection-string+"
50 .RecordSource = strSQL
60 .Refresh
70 Set dbo = .OraDatabase
80 End With 'With OraDataControl
ExitSub:
90 On Error GoTo 0
100 Exit Sub
ErrorHandler:
110 Debug.Print "Error: '" & Err.Description & "' (" & Err & ") at line " & Erl
120 Resume ExitSub
End Sub

Obviously, in the actual code, I am using a valid username/password, db-connection-string, and SQL strings. The code run fine until it hits line 70, where I try to set an OraDatabase object to the .Oradatabase property of the control. I get the following error message:

Error: 'Object doesn't support this property or method' (438) at line 70

What would be the proper way to reference the OraDatabase property of the control?

Thank you,
Todd

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points