Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / June 2005

Tip: Looking for answers? Try searching our database.

SendObject action was canceled

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JMorrell - 03 Feb 2005 23:27 GMT
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,
they can cancel the application.  When they do this, I get the following
error:

Run-time error '2501':
The SendObject action was canceled.

That's understandable and ok, but the option buttons on the msgbox are "End"
or "Debug".  I just want the process to end.  How can I force it to end
without the error message coming up?

tia,
Signature

JMorrell

M.L. Sco Scofield - 04 Feb 2005 01:36 GMT
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,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.