Disable Error Messages

  • Thread starter Thread starter Matt Howard
  • Start date Start date
M

Matt Howard

On my form I have a list box with names of employees.
When you try to enter a name that is not on the list, I
have a message box come up that informs them of this and
the procedure to follow. What I need is to disable the
default not in list message that Access provides. I use
Access 2003, and I have the following code:

DoCmd.SetWarnings False

I was under the impression that this killed the error
messages but it does not.

Any help is appreciated.

Thanks,

Matt Howard
 
In the code that you run on the NotInList event, include this step:

Response = acDataErrContinue

That will bypass the built-in ACCESS message.
 
Thanks, that worked like a charm.

I'm still new to VB and VBA, I'm not sure I completely
understand what that command does.

Matt
 
Hi Matt,

The best explanation comes right out of Access help:

"Response: The setting indicates how the NotInList event was handled. The Response argument can be
one of the following intrinsic constants:

Constant Description-

acDataErrDisplay (Default) Displays the default message to the user. You can use this when you don't
want to allow the user to add a new value to the combo box list.

acDataErrContinue Doesn't display the default message to the user. You can use this when you want to
display a custom message to the user. For example, the event procedure could display a custom dialog
box asking if the user wanted to save the new entry. If the response is Yes, the event procedure
would add the new entry to the list and set the Response argument to acDataErrAdded. If the response
is No, the event procedure would set the Response argument to acDataErrContinue.

acDataErrAdded Doesn't display a message to the user but enables you to add the entry to the combo
box list in the NotInList event procedure. After the entry is added, Microsoft Access updates the
list by requerying the combo box. Microsoft Access then rechecks the string against the combo box
list, and saves the value in the NewData argument in the field the combo box is bound to. If the
string is not in the list, then Microsoft Access displays an error message."
 
Back
Top