Article ID: 232341 - View products that this article applies to.
This article was previously published under Q232341
This article has been archived. It is offered "as is" and will no longer be updated.
This article describes how to populate a list box or combo box control on an Outlook custom form.
There are a variety of ways to populate a list box or combo box on an Outlook form. The controls can be populated either at design-time or at run-time.
Populating List Boxes and Combo Boxes at Design-TimeIf you have a predetermined and unchanging set of possible values, you can populate list boxes and combo boxes when designing the form. The following steps illustrate how to set up a simple list box control on an Outlook form.
NOTE: In step 5, instead of using a Text field, you can use a Keywords field to store the data for a list box (not a combo box). When a list box is bound to a Keywords field, check boxes will appear next to the possible values in the list box and the user can make multiple selections. All of these selections are stored in the multi-value Keywords field. However, Keywords fields are limited to 255 characters, so this type of field should be used only if the user will be selecting from a relatively few possible values.
For more information about this limitation of the Keywords field, please see the following article in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/222475/EN-US/ )OL2000: ListBox Bound to Keywords Field Unexpectedly Changes
Dynamically Populating List Boxes and Combo Boxes at Run-TimeMany solutions require that the possible values in a list box or combo box be up-to-date or refreshed regularly. The values are typically stored in some other location and need to be retrieved every time the item is opened. To accomplish this, you can add Visual Basic Scripting Edition (VBScript) code to the form and use an Item_Open event to run code whenever an item is opened. This code will fill the list box or combo box with possible values.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
(http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS)There are various ways in which you can use VBScript to populate a list box or combo box.
PossibleValues PropertyIf you have a relatively simple list box or combo box to work with, you can automate the design-time steps by using the PossibleValues property of the control. This property is unique to Outlook and should be set to a semicolon-delimited string, similar to the design-time steps earlier. To see how the PossibleValue property can be implemented, follow these steps:
AddItem MethodThe AddItem method is typically used when you are looping through a series of data. As you loop through the data, you add items to the list box or combo box one at a time.
For an example of using the AddItem method to populate a combo box, please see the following article in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/201100/EN-US/ )OL2000: How to Populate a Combo Box with Your Contacts
List PropertyList boxes and combo boxes have a List property that allows you to specify an array which contains the data the control should use. If your programming solution is already using arrays to store data, using this approach can provide the simplest programming solution. Also, one key advantage to using the List property is that if you wish to populate the list box or combo box with multi-column data, the List property supports multi-dimensional arrays to accomplish this.
To populate a two-column list box with data from your Contacts folder, follow these steps:
For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/146636/EN-US/ )OL2000: Questions About Custom Forms and Outlook Solutions
(http://go.microsoft.com/fwlink/?LinkId=151500)for other considerations.