Visual Basic 6 Problem

Miscellaneous Forums/General Discussion/Visual Basic 6 Problem

Ok, i think i've pretty much adapted your concept to my coding, only having one problem know and that that i get an error 'subscript out of range' when the highlighted error gives:
contacts(tmp(0)).sort_key = <subscript out of range>
i get this error when doing the select case sorttype, i'm not sure why here the code:
 
Sub Sort_contacts(ByRef Contacts() As Contact, ByVal Method As String, ByVal field As String, ByRef comparisions As Integer)

comparisions = 0
sort_type = Form1.Comfield(0).ListIndex

For tmp(0) = 1 To TotContacts
    Select Case sort_type
        Case 0
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).First_Name
        Case 1
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Last_Name
        Case 2
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Add_Line1
        Case 3
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Add_Line2
        Case 4
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Add_Line3
        Case 5
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Post_code
        Case 6
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Tel
        Case 7
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Mob
        Case 8
            Contacts(tmp(0)).Sort_key = Contacts(tmp(0)).Email
    End Select
Next

Select Case Method
    Case "simple"
        For OUTER = 1 To TotContacts
            For INNER = OUTER + 1 To TotContacts
                If Contacts(Group, OUTER).Sort_key > Contacts(Group, INNER).Sort_key Then
                    tmp2 = Contacts(Group, OUTER)
                    Contacts(Group, OUTER) = Contacts(Group, INNER)
                    Contacts(Group, INNER) = tmp2
                End If
                comparisions = comparisions + 1
                'sortprog.Value = (100 / UBound(Contacts())) + Comparisons
            Next
        Next
    Case "bubble"
        FLAG = True
            Do While FLAG
                FLAG = False
                For Counter = 0 To TotContacts - 1
                    If Contacts(Group, Counter).Sort_key > Contacts(Group, Counter + 1).Sort_key Then
                        tmp2 = Contacts(Group, Counter)
                        Contacts(Group, Counter) = Contacts(Group, Counter + 1)
                        Contacts(Group, Counter + 1) = tmp2
                        FLAG = True
                    End If
                    comparisions = comparisions + 1
                    'sortprog.Value = (100 / UBound(Contacts())) + Comparisons
                Next
            Loop
End Select
End Sub


i've declared all the varialbe types correctly, what could be the problem?
Thanks