Microsoft KB Archive/187554

= OL98: Can't Use Square Brackets to Sort User-defined Fields =

Article ID: 187554

Article Last Modified on 7/31/2001

-

APPLIES TO


 * Microsoft Outlook 98 Standard Edition

-



This article was previously published under Q187554



SYMPTOMS
If you programmatically sort a collection of items based on a user-defined field, the items may not be sorted.



CAUSE
You used square brackets to delimit the name of the user-defined field.



WORKAROUND
Correct

Use the following syntax MyItems.Sort "Contact Type", False where Contact Type is the name of a user-defined field.

Incorrect

Do not use square brackets around the user-defined field. Do not use the following syntax to sort a collection of items based on a user-defined field: MyItems.Sort "[Contact Type]", False



STATUS
The Sort method is not designed to function with user-defined fields. Although the workaround described in this article works in all known cases, Microsoft does not support its use. Also, this functionality may not exist in future versions of Outlook, raising the risk that your solution may not function correctly in the future.



MORE INFORMATION
IMPORTANT: In Microsoft Outlook 2000, the Outlook Visual Basic Reference (Vbaoutl9.chm) explicitly states that the Sort method does not support user-defined fields.

This problem does not occur when using a standard, or pre-defined, Outlook field.

