Message Box (Getting 2 boxes)

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi;

I created a Public Function for "Not In List" with a Msgbox and only an "Ok"
button.
Want to use the same Msgbox response in several "Not In List".

It works correctly in a Sub procedure:
Private Sub cbxName_NotInList(NewData As String, Response As Integer)
MsgBox "Custom Message."
Response = acDataErrContinue
End Sub

but when used as a Function and the "Ok" button is clicked in the custom
Msgbox, Access's own internal msgbox then pops up.

How do you get only the msgbox that you want to display.

Searched microsft's Access support center. Nothing even close.

Thanks in Advance.

Andy
 
Andy said:
Hi;

I created a Public Function for "Not In List" with a Msgbox and only
an "Ok" button.
Want to use the same Msgbox response in several "Not In List".

It works correctly in a Sub procedure:
Private Sub cbxName_NotInList(NewData As String, Response As Integer)
MsgBox "Custom Message."
Response = acDataErrContinue
End Sub

but when used as a Function and the "Ok" button is clicked in the
custom Msgbox, Access's own internal msgbox then pops up.

How do you get only the msgbox that you want to display.

Searched microsft's Access support center. Nothing even close.

Thanks in Advance.

Andy

What is the code for your public function, and how are you calling it?
 
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?

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

Thanks.

Andy
 
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.
 
Dirk;

Begining to think your answer is absolutely correct.about the Response
argument.

Tried: DoCmd.SetWarnings False
That didn't work either.

Thank You for Your help.

Perhaps I can return the favor some day.

Andy
 
Back
Top