## PRB: OnChange Property Not Triggered with Combo Box Selection

Article ID: Q115126
Creation Date: 19-MAY-1994
Revision Date: 19-SEP-1996

The information in this article applies to:

- Microsoft Access version 1.1, 2.0

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

If you use a macro or an event procedure in a combo box's OnChange property, that macro or event procedure does not run when you select an item from the combo box's drop-down list.

RESOLUTION

Instead of using the macro or event procedure in the combo box's OnChange property, use it in the BeforeUpdate or AfterUpdate property. The macro or event procedure will then run when you select an item from the combo box's drop-down list.

STATUS

This behavior no longer occurs in Microsoft Access for Windows 95 version 7.0.

MORE INFORMATION

A combo box's OnChange property is triggered only when the Text property changes, either when you type directly in the combo box, or when you change the Text property using a macro or Access Basic code. The OnChange property is not triggered when you select an item from the drop-down list.

Steps to Reproduce Behavior

CAUTION: Following the steps in this example will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database.

1. Open the sample database NWIND.MDB.
2. Create the following new macro, and then save the macro as Test Change:

>           Test Change Actions
>           -------------------
>           MsgBox
>              Message: This is a test of the OnChange property.

- Open the Orders form in Design view.
- Set the Employee ID combo box's OnChange property to:

>           Test Change

- View the form in Form view.
- In the Employee ID combo box, select an employee from the drop-down list. Note that the Test Change macro does not run.
- In the Employee ID combo box, type any text. Note that the Test Change macro runs.

  REFERENCES

  Microsoft Access "Building Applications," version 2.0, Chapter 8, "Events"

  Microsoft Access "User's Guide," version 2.0, Chapter 25, "Using Macros with Forms"

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

©1997 Microsoft Corporation. All rights reserved. Legal Notices.
Additional reference words: 1.10 2.00
KBCategory: kbusage
KBSubcategory: PgmOthr