Microsoft KB Archive/123867

= ACC2: NotInList Event Is Not Triggered =

Article ID: 123867

Article Last Modified on 11/6/2000

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q123867



SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.

The Access Basic code or macro specified in a combo box's OnNotInList property setting is not triggered when you enter a value in the combo box that is not in the combo box's list.



CAUSE
The NotInList event is triggered only if the value entered in the combo box cannot be uniquely associated with any item in the combo box's list, and if the combo box's LimitToList property is set to Yes.



RESOLUTION
Make sure the combo box's LimitToList property is set to Yes.

Also, check to see if the value you entered in the combo box can be uniquely associated with an item in the combo box's list. For example, assume a combo box with the following list:

  Beverages Condiments Confections Dairy Products

If you type the letter "D" in the combo box, the "Dairy Products" item will be selected in the combo box and the NotInList event will not be triggered. If you type the letter "C" in the combo box, the NotInList event will be triggered, because "C" is not uniquely associated with an item in the list. If you type "COND" in the combo box, the "Condiments" item will be selected and the NotInList event will not be triggered.



STATUS
This behavior no longer occurs in Microsoft Access version 7.0.



Steps to Reproduce Behavior
 Open the sample database NWIND.MDB.  Create a blank, new form. Add a combo box with the following properties to the form:

     RowSourceType: Table/Query RowSource: Categories ColumnCount: 2 ColumnWidths: 0;1 BoundColumn : 2 LimitToList: Yes AutoExpand: No                         Set the combo box's OnNotInList property to the following event procedure:

Sub Field0_NotInList (NewData As String, Response As Integer) MsgBox "This item is not in the combo box." End Sub  View the form in Form view. Type CON in the combo box and then press the TAB key. The "This item is not in the combo box" message box appears as you expect.</li> Type COND in the combo box and then press TAB. Note that "Condiments" is automatically selected in the combo box and that the NotInList event is not triggered.</li></ol>

<div class="references_section">