Results 1 to 14 of 14

Thread: (Resolved) Search through Contacts gets error after 75 records (all the time)

Threaded View

  1. #1

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    (Resolved) Search through Contacts gets error after 75 records (all the time)

    I am searching through an Outlook Contacts folder and it gets a type mismatch after 75 record out of 110. I can not tell which record it is on for the search does not seem to be in any order that i know of but it is the same each time I run it. The code is correct so how can you get a type mismatch after reading 75 records???? The code is as follows: What can be the problem

    The error is generated on the following line:

    If olContact.Categories <> "" Then

    at this point olContacts turns to equal Nothing

    What happened???????
    How do I correct it?


    Dim i As Long
    Dim j As Long
    Dim olApp As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim olFolder As MAPIFolder
    Dim olContact As ContactItem
    Dim Cat() As String
    Dim Addit As Boolean
    Dim Name As String


    Combo2.Clear

    Set olApp = New Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")


    Set olFolder = olNS.GetDefaultFolder(olFolderContacts) 'The Contacts Folder

    For Each olContact In olFolder.Items

    If olContact.Categories <> "" Then

    Addit = True
    Cat = Split(olContact.Categories, ",")

    For i = 0 To UBound(Cat)

    For j = 0 To Combo2.ListCount - 1

    If Cat(i) = Combo2.List(j) Then
    Addit = False
    Exit For
    End If

    Next j

    If Addit Then Combo2.AddItem Cat(i)
    Addit = True

    Next i

    End If

    Next
    Last edited by randem; Nov 7th, 2002 at 08:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width