Andy said:
Dirk;
Public Function CustomMsgBox()
MsgBox "Custom Message."
Response = acDataErrContinue
End Function
And it' called from the "On Not In List" Event.
=CustomMsgBox()
It calls correctly, but after clicking the Ok button from that msgbox
getting "internal" msgbox informing that the item is not in the list.
How do you get only the CustomMsgBox?
The problem is that the Response argument is only available within an
event procedure that is called directly by the event handler. I don't
think you can use your public function in this fashion, because the
inline call, "=CustomMsgBox()", isn't going to have the same parameter
linkage to the event handling code that a true event procedure does. I
believe you're going to have to have an actual event procedure for each
control where you want to handle the NotInList event this way. You
could still put the custom message box code in a separate function, but
it's going to end up being something like this:
'----- code in a standard module -----
Public Function CustomMsgBox()
MsgBox "Custom Message."
End Function
'----- end standard-module code -----
'----- code in various form modules -----
Private Sub cboCombo1_NotInList( _
NewData As String, Response As Integer)
Call CustomMsgBox
Response = acDataErrContinue
End Sub
Private Sub cboCombo2_NotInList( _
NewData As String, Response As Integer)
Call CustomMsgBox
Response = acDataErrContinue
End Sub
'----- end code in various form modules -----
So each combo box would have to have an actual event procedure.
Searched Microsoft's KB and all of Msft. With at least 40 different
combinations of words on the first day, and another 30 or so the
second. Sent an e-mail to (e-mail address removed) telling them that
nothing even comes close to what I'm searching for.
For instance, searched for:
Access 2000 user-defined MESSAGE BOX FOR ON NOT IN LIST
That returned among many others just as obscure:
PRB: Error Message "Unspecified Error Was Not Handled" When You Use
Visual InterDev to Debug ASP Page
I don't know what I'd search for to have a hope of finding an answer for
a question like this. The answer I've given is implicit in the nature
of events and event procedures, but unless MS happened to have posted an
example somewhere and described it in those terms, I don't know how
you'd come up with it. Fortunately, there are newsgroups.
By the way, did you try searching Google Groups in the
mcirosoft.public.access.* hierarchy? That's also a very good place to
start.