I have a combo box - I want to display an error message when the item entered
is not in the list.
I created an msgbox macro to display the text that will display.
In the Combo box properties list, I placed the macro name in the "on Not in
list " option.
I can run the macro by itself and it displays ok. But when I enter an item
not in the combo box list, it gives me no error message.
What am I doing wrong.
Pat

Signature
Pat
Ken Sheridan - 27 Jul 2005 18:45 GMT
You'll need to use code for this rather than a macro as you need to set the
return value of one of the NotInList event procedure's arguments. Put
something like this in the event procedure:
Dim ctrl As Control
Dim strMessage As String
Set ctrl = Me.ActiveControl
strMessage = NewData & "is not in the list."
MsgBox strMessage, vbExclamation, "Error"
ctrl.Undo
Response = acDataErrContinue
> I have a combo box - I want to display an error message when the item entered
> is not in the list.
[quoted text clipped - 6 lines]
>
> Pat
tina - 28 Jul 2005 09:32 GMT
as well as following Ken's instructions for the VBA code, you have to set
the combo box's LimitToList property to Yes - or the NotInList event will
not run.
hth
> I have a combo box - I want to display an error message when the item entered
> is not in the list.
[quoted text clipped - 6 lines]
>
> Pat