R
Richard Edwards
The following code pulls in the company names of the people listed in our
contact list.
Obviously we have more than one person for each company, so the list shows
the company name more than once.
Is there a way of filtering and returning one entry person company?
Thank you.
Richard
-----
Function Item_Open()
Dim cmbContacts
Dim cmbView
Dim OVCtl1
Dim IsLoading
Dim RestrictedContactItems
Const olFolderContacts = 10
On Error Resume Next
Set cmbContacts =
Item.GetInspector.ModifiedFormPages("P.2").Controls("cmbContacts")
Set MyContacts =
Application.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts)
Set MyItems = MyContacts.Items
Set RestrictedContactItems = MyItems.Restrict("[Company] <> ''")
'Sort by Company in ascending order
RestrictedContactItems.Sort "[Company]"
For Each MyItem in RestrictedContactItems
cmbContacts.AddItem MyItem.CompanyName
Next
IsLoading = True
cmbContacts.ListIndex = 0
IsLoading = False
End Function
contact list.
Obviously we have more than one person for each company, so the list shows
the company name more than once.
Is there a way of filtering and returning one entry person company?
Thank you.
Richard
-----
Function Item_Open()
Dim cmbContacts
Dim cmbView
Dim OVCtl1
Dim IsLoading
Dim RestrictedContactItems
Const olFolderContacts = 10
On Error Resume Next
Set cmbContacts =
Item.GetInspector.ModifiedFormPages("P.2").Controls("cmbContacts")
Set MyContacts =
Application.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts)
Set MyItems = MyContacts.Items
Set RestrictedContactItems = MyItems.Restrict("[Company] <> ''")
'Sort by Company in ascending order
RestrictedContactItems.Sort "[Company]"
For Each MyItem in RestrictedContactItems
cmbContacts.AddItem MyItem.CompanyName
Next
IsLoading = True
cmbContacts.ListIndex = 0
IsLoading = False
End Function