Defining a Key Column for a Table 

You can access a given table Row by calling the Item property with a key value as parameter. To enable key access, you must specify the column in which the key value should be found. Use the KeyColumn property to specify the column name or index of the column. The following restrictions apply to the column used as a key column:

Dim oTable as Object

Dim oRow as Object

Dim oCustRow as object

dim sCustomerId as string

REM oTable contains the following columns ‘Name’ and ‘CustomerID’, ‘Street’ …

REM CustomerID is unique in the table

sCustomerId = ‘0815’

REM Good: Find a special row by using key access

oTable.Columns.KeyColumn = "CustomerID"

Set oCustRow = oTable.Rows.Item (sCustomerId)

oCustRow.Value(1) = ….

REM Bad: Normal search to find the data for the specified CustomerID

For each oRow in oTable.Rows

if sCustomerId = oRow.Value("CustomerID")

Set oCustRow = oRow ‘Remember Row object

break

end if

Next oRow

oCustRow.Value(1) = ….