OriginalItem Method

Description

Returns the OraField object based on the original column name used in the SELECT statement in the dynaset. Not available at design time and read-only at run time.

Usage

set OraField = OraFields.OriginalItem(field_index)
set OraField = OraFields.OriginalItem(original_name)

Arguments

The arguments for the method are:

Arguments Description
field_index Field index of the original column name.
original_name Original field name specified in the SQL statement.

Remarks

This is property is useful when a SQL statement contains 'schema.table.col' as the Name of the field, and retrieves the field object specific to that original name.

Examples

The following example shows the use of the OriginalItem method. Copy and paste this code into the definition section of a form. Then, press F5.

Sub Form_Load ()
 
 'Declare variables
 Dim OraSession As OraSession 
 Dim OraDatabase As OraDatabase 
 Dim OraDynaset As OraDynaset 
 Dim OraFields As OraFields
 
 'Create the OraSession Object.
 Set OraSession = CreateObject("OracleInProcServer.XOraSession")
 
 'Create the OraDatabase Object by opening a connection to Oracle.
 Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0&)
 
 Set OraDynaset = OraDatabase.CreateDynaset("select scott.emp.deptno," & _
     "dept.deptno from scott.emp, scott.dept where dept.deptno = emp.deptno", 0&) 
 'Get the Field collection object
 Set OraFields = OraDynaset.Fields
 
 'get the original field object. Returns "scott.emp.deptno" 
 
 MsgBox OraField.OriginalName
 
 Set OraField = OraFields.OriginalItem(1)
 
 'Returns "dept.deptno" 
 MsgBox OraField.OriginalName
 
End Sub