Need Help with Public Forms

C

Chris

I have a Public Folder which holds a list of Customers (Contacts)

I've created a custom form based on Appointment. I have an extra tab
called Consultants Activity Recording, and on that tab I also have a
combobox called ComboBox1.

When I click on the combobox, I want it to display a list of all the
companys in my public folder.

I've added the following code to the form, but my combobox is blank.
What have I done wrong? Many Thanks.

Function Item_Open()
Dim oParentFolder
Dim oFolder
Dim oItems
Dim oControl
Dim i
on error Resume next

Set oParentFolder =
Application.ActiveExplorer.CurrentFolder.Parent.Parent
Set oFolder = oParentFolder.Folders("Public
Folders").Folders("Favorites").Folders("Discrete Customers")
Set oItems = oFolder.items
oitems.sort("Company")
set oControl = Item.GetInspector.modifiedFormPages("Consultants
Activity Recording").Controls("ComboBox1")
For i = 1 to oitems.count
oControl.AddItem oitems.item(i).Company
Next
oControl.Style = 2

Set oControl = nothing
set oItems=nothing
set oFolder=nothing
set oParentFolder=nothing

End Function
 
S

Sue Mosher [MVP-Outlook]

Comment out the On Error Resume Next, and I think you'll find out where the problems are pretty fast. HINT: Your next step after that should be to look at the object browser in VBA to find out the correct property name.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Chris

Thanks, I got it working.

oItems.Sort ("Company")

Set FormPage = Item.GetInspector.ModifiedFormPages("Consultants
Activity Recording")
Set oControl = FormPage.Controls("ComboBox1")

For i = 1 To oItems.Count
oControl.AddItem oItems.Item(i).Subject
Next

oControl.Style = 2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top