Combo box: Not in List
-
- StarLounger
- Posts: 72
- Joined: 08 Mar 2010, 13:05
- Location: Manassas, VA
Combo box: Not in List
I am using Access 2002, SP3 and have a combo box on a form screen. I set the property of Limit to List to yes and created a msgbox to display if the user types an item not in the list, however after displaying my specific message, Access also displays the program message that the item is not in the list. What code do I need to add in order to eliminate the program message and only display my msgbox text.
-
- Administrator
- Posts: 78478
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Combo box: Not in List
The NotInList event procedure has an argument Response that you can use for this.
By default, Response has the value of acDataErrDisplay, meaning that Access will display the default error message.
If you add the value entered by the user to the source table for the combo box, you can use
Response = acDataErrAdded
to tell Access to suppress the error message and to update the list. If you don't add the value to the source table, you can use
Response = acDataErrContinue
to suppress the built-in error message.
By default, Response has the value of acDataErrDisplay, meaning that Access will display the default error message.
If you add the value entered by the user to the source table for the combo box, you can use
Response = acDataErrAdded
to tell Access to suppress the error message and to update the list. If you don't add the value to the source table, you can use
Response = acDataErrContinue
to suppress the built-in error message.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 72
- Joined: 08 Mar 2010, 13:05
- Location: Manassas, VA
Re: Combo box: Not in List
Thanks. That worked perfectly. I have added that to my database that holds all my Access problem solutions.