ACC2: Cannot Clear Selection in LimitToList Combo BoxLast reviewed: May 7, 1997Article ID: Q123737 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you delete the selected entry in a combo box, you may receive the following error message:
The text you enter must match an entry in the list. CAUSEThe combo box's LimitToList property is set to Yes. When a combo box's LimitToList property is set to Yes, an empty selection does not match any value in the list. This behavior makes clearing a selection in the combo box difficult.
RESOLUTIONYou can work around this behavior by including the following Access Basic procedure in a new or existing module in your database and calling it from the Change event of your combo box:
Sub AdjustEmptyCombo (C As Control) On Error Resume Next If IsNull(C.Text) Or C.Text = "" Then C = Null End SubFor example, in the sample database, NWIND.MDB, you can call the AdjustEmptyCombo procedure from the Change event of the Salesperson combo box on the Orders form:
Sub Employee_ID_Change () AdjustEmptyCombo Me![Employee ID] End SubYou must pass the combo box control as an argument to the AdjustEmptyCombo procedure. NOTE: This technique will not work if the field the combo box is bound to is a Required field. For more information about Required fields, search for "Required" then "Required Property" using the Microsoft Access 2.0 Help menu.
STATUSThis behavior no longer occurs in Microsoft Access version 7.0.
MORE INFORMATION
Steps to Reproduce Behavior
REFERENCESFor more information about the NotInList event, search for "NotInList," and then "NotInList Event" using the Microsoft Access Help menu. |
Keywords : FmsCmbo kberrmsg kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |