Not in List combo box event

  • Thread starter Thread starter diarmuidq
  • Start date Start date
D

diarmuidq

Is there a way of replacing the default message? Is I have limit to list
set, I'd like to replace the "The text you entered isn't an item on the
list" message.
Thanks
Diarmuid
 
Have you looked into the combo box's NotInList event? I suspect you can add
in your personalized message when that event fires.

Good luck

Jeff Boyce
<Access MVP>
 
I can add in my own message, but the default message then appears after it.
Clicking ok twice looks a bit lame. What I was trying to do - if the client
id not in the list, open a pop up to add the client. Which works, but when
the pop up closes, the "The text you entered isn't an item on the
list" message apepars. That is, on the end sub of the NotInList event.
Confusing for users!
So I'm looking to stop the message appearing really,
 
Hi Diarmuid,

Thanks for your post. Based my research, it seems that you need to use your
own codes to check the input in the combo box and to make the customized
message box pop up.

You can set the "Limit To List" property to "No" and type your own code for
"On Lost Focus" event to check the combo box and make the customized
message box pop up.

Thanks for using MSDN newsgroup.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
The NotInList event includes a "Response" field -- this will control whether
Access displays its own error message.

The possible values for Response (copied from the Access 2000 HELP listing
for NotInList):

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.

Good luck!

Jeff Boyce
<Access MVP>
 
Back
Top