1 Reply Latest reply on May 22, 2012 1:02 PM by 936790

    Error referencing the OraDatabase property of an Oracle Activex Control

      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.

           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
      90 On Error GoTo 0
      100 Exit Sub
      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,