Creating a multi-select List box on an Outlook Form?

tanharrison used Ask the Experts™
I am creating a basic Outlook Form for when users want to submit an IT Request.

On the form I want to have a field called Category. Within this field I list several types of categories and I want to allow the user to select multiple categories if they want. so e.g.

Category: Outlook

I have provided an attached image as well. The form is not linked to a database, I don't intend to either. The problem is, when you select any entry within this listbox, none of them stay selected when the form is received at the recipient mailbox. how can I get the listbox to retain the user's cursor selection(s)?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


image of form and listbox
This is how the listbox looks like on the form.
Top Expert 2009
This may depend on what field the listbox is bound to.  You say you want a multi-select listbox, but you show only one item selected.  To save multiple values, you need to bind the control to a multi-select field.  The Categories field is such a field, and it is already on several of the standard Outlook forms.  If you are using the standard Outlook Categories field, then it is best to keep the original control bound to it, rather than making your own control.  However, you might be able to use your control, providing you make sure it is bound to the standard Categories field.

If you are using a custom field instead, then you need to make sure it exists in the user's Outlook.  Here is some standard code that does this, from Sue Mosher's excellent Microsoft Outlook Programming book:
Function CopyFieldsToInbox()
'Written by Helen Feddema 23-Jan-2006
'Last modified 17-Feb-2006

	Dim itmDummy

	'Create custom fields in recipient's Inbox to match ones in this form
	Set ups = Item.UserProperties
	Set nms = Application.GetNamespace("MAPI")

On Error Resume Next
	Set fldInbox = nms.GetDefaultFolder(6)

	If Not fldInbox Is Nothing Then
		Set itmDummy = fldInbox.Items.Add("IPM.Post")
		For Each up In ups
			If up.Type <> 19 And up.Type <> 18 And up.Type <> 0 Then
				itmDummy.UserProperties.Add up.Name, up.Type, True
			End If
	End If

End Function

Open in new window

Top Expert 2009
Running this code from the custom form's Open event ensures that any custom fields in the form that don't exist in the user's Outlook will be created, so data stored in those fields will be displayed on the form.
Top Expert 2009

You don't say what version of Outlook you are running, or which standard form is the basis for your custom form.  Different fields (and controls) are available, depending on the original form.


Thanks for your suggestions Helen. At this stage I haven't had time to work on the forms but I'll give your solutions a try when I do!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial