Listing 1
Private m_LastName As String
Private m_FirstName As String
Private m_Age As Integer
Private m_OwnHome As Boolean
Private m_NumberOfBathrooms As Integer
Private m_SSN As String

Public Property Get Key() As String
	Key = Left$(m_LastName) & Left$(m_FirstName) & Right$(m_SSN)
End Property

Public Property Get SSN() As String
	SSN = m_SSN
End Property

Public Property Set SSN(strSSN As String)
	m_SSN = strSSN
End Property

Public Property Get LastName() As String
	LastName = m_LastName
End Property

Public Property Set LastName(strLastName As String)
	m_LastName = strLastName
End Property


Listing 2
Public Function Item(ByVal Key As String) As cPerson
	Dim oPerson As cPerson
	
	' set an error handler
	On Error GoTo ErrorHandler
	
	' get the item
	Set oPerson = m_colPersons.Item(UCase$(Key))
	
	' check if it is good or not
	If Not oPerson Is Nothing Then
		' set return object reference
		Set Item = oPerson
		' release local reference
		Set oPerson = Nothing
	End If
	Exit Function

ErrorHandler:
	MsgBox ("A person with the key: " & Key & " does not exist in the collection")
	Set Item = Nothing
	
	Exit Function
End Function


Listing 3
Public Function Exists(ByVal Key As String) As Boolean
	Dim oPerson As cPerson
	
	' set an error handler
	On Error Resume Next
	
	' init return to True; if item does not exist 
	' the error handler will be set to False
	Exists = True
	
	' get the item
	Set oPerson = m_colPersons.Item(UCase$(Key))
	
	' check if it is good or not
	If Err.Number <> 0 Then
		Exists = False
	End If
End Function

