Try this:
'<SampleCode>
Private Sub cmdYourButtonName_Click()
On Error GoTo ErrorRoutine
Const errUserCanceledAction As Long = 2501
DoCmd.SelectObject '*** Your parameters ***
RoutineExit:
Exit Sub
ErrorRoutine:
If Err.Number = errUserCanceledAction Then
'Do nothing
Else
MsgBox "Error number: " & Err.Number & vbCrLf & vbCrLf & _
Err.Description, vbCritical, "Error"
End If
Resume RoutineExit
End Sub
'</SampleCode>
This also works for canceled reports when you use the NoData event.
Good luck.
Sco
M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Denver Area Access Users Group Vice President www.DAAUG.org
MS Colorado Events Administrator www.MSColoradoEvents.com
Useful Metric Conversion #18 of 19: 8 nickels = 2 paradigms (My personal
favorite)
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
> In a form, I give the user the opportunity to e-mail the data from the form
> to someone. If they change their mind after the e-mail application opens,
[quoted text clipped - 9 lines]
>
> tia,
JMorrell - 07 Feb 2005 17:13 GMT
With a little modification this works. Thanks for the help!
JMorrell
> Try this:
>
[quoted text clipped - 50 lines]
> >
> > tia,
M.L. Sco Scofield - 08 Feb 2005 02:52 GMT
You're welcome.
Sco
M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Denver Area Access Users Group Vice President www.DAAUG.org
MS Colorado Events Administrator www.MSColoradoEvents.com
Useful Metric Conversion #18 of 19: 8 nickels = 2 paradigms (My personal
favorite)
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
> With a little modification this works. Thanks for the help!
>
[quoted text clipped - 54 lines]
> > >
> > > tia,
Henry - 27 Jun 2005 10:35 GMT
I have tried this but I cant get ANY trapping working, code alway interrupts
and I wonder why the code never makes it to ErrorRoutine:
Private Sub Cmd0_Click()
On Error GoTo ErrorRoutine
DoCmd.SendObject acSendNoObject, , , "info@ms.com", , , "header",
"hello", True
RoutineExit:
Exit Sub
ErrorRoutine:
If Err.Number = 2501 Then
'Do nothing
Else
MsgBox "Error number: " & Err.Number & vbCrLf & vbCrLf & _
Err.Description, vbCritical, "Error"
End If
Resume RoutineExit
End Sub
> Try this:
>
[quoted text clipped - 50 lines]
> >
> > tia,