ACC2: NotInList Event Is Not Triggered

Last reviewed: May 30, 1997
Article ID: Q123867
The information in this article applies to:
  • Microsoft Access version 2.0

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.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database NWIND.MDB.

  2. 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
    

  3. 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
    
    

  4. View the form in Form view. Type "CON" (without quotation marks) 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.

  5. Type "COND" (without quotation marks) 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.

REFERENCES

For more information about the OnNotInList property, search for "OnNotInList" then "OnNotInList Property" using the Microsoft Access Help menu.


Keywords : FmsCmbo kbusage
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.