Unwanted error message display

K

Kevin Sprinkel

The following code is executed by pressing a command
button on a form to display a report filtered for the
current record. The report displays data from various
subforms.

If there is no data in the subforms to display, the user
sees two message boxes. I'd like to display a more user-
friendly message. The user sees:

"No data meets selection criteria."

and

"The OpenReport Action was canceled."

the latter of which is the result of the MsgBox call.

Can anyone tell me how avoid displaying the first message,
freeing me to display a custom message?

Kevin Sprinkel
 
A

Andy

Kevin;

Dirk Goldgar was kind enough to supply me with this answer:

Private Sub YourControlName_NotInList(NewData As String, Response As
Integer)
On Error GoTo Err_YourControlName_NotInList
MsgBox "Your Message is typed here.", vbExclamation, ""

Exit_YourControlName_NotInList:
Exit Sub

Err_YourControlName_NotInList:
MsgBox "Second Message"
Resume Exit_YourControlName_NotInList
End Sub

Modify it as needed.

Andy
 
K

Kevin Sprinkel

Thanks, Andy.

-----Original Message-----
Kevin;

Dirk Goldgar was kind enough to supply me with this answer:

Private Sub YourControlName_NotInList(NewData As String, Response As
Integer)
On Error GoTo Err_YourControlName_NotInList
MsgBox "Your Message is typed here.", vbExclamation, ""

Exit_YourControlName_NotInList:
Exit Sub

Err_YourControlName_NotInList:
MsgBox "Second Message"
Resume Exit_YourControlName_NotInList
End Sub

Modify it as needed.

Andy





.
 
Top