End Sub

The collection, colEmployees, is declared as a new collection and the record, recEmployee, as a new variable of the custom object type.

After the object's properties are given values, the record, recEmployee, is added to the collection. The second parameter of the Add method applies a unique key to the record—in this case, the employee ID number. This allows a specific record to be quickly accessed, as in the second message box (colEmployees("l65l").EmpWeeklyPay) (see Figure 20.9).

0 0

Post a comment