473,382 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Email from Access - handle cancel error

I'm temporarily stumped on how to handle/suppress an error (2501) if a user
cancels sending an email. I'm using DoCmd.SendObject to trigger an Outlook
send window, which works OK, but if the msg is cancelled (not sent) then a
VB runtime error msg appears (#2501) that I would like to either hide or
deal with.
-Ed
Nov 13 '05 #1
3 6108
Do you have an OnError clause in the calling module?

Is it triggered?

If you don't have an OnError clause, see the VB help for OnError

King Ron of Chi

Nov 13 '05 #2
"Ed Robichaud" <ed*********@wdn.com> wrote:
I'm temporarily stumped on how to handle/suppress an error (2501) if a
user cancels sending an email. I'm using DoCmd.SendObject to trigger
an Outlook send window, which works OK, but if the msg is cancelled
(not sent) then a VB runtime error msg appears (#2501) that I would
like to either hide or deal with.
-Ed


Your first line of code should be an 'On Error GoTo' statement. You can
then handle the error thus:

If Err.Number = 2501 Then
Exit Sub
Else
Beep
MsgBox Err.Number & ", " & Err.Description
End If

Don't forget the 'Exit Sub' before the error handler too.

Keith.
www.keithwilby.com
Nov 13 '05 #3
Thanks. I had all that, but foolishly had it sequenced after the
SendObject.
-Ed

"Keith" <ke*********@AwayWithYerCrap.com> wrote in message
news:Xn***********************@10.15.188.42...
"Ed Robichaud" <ed*********@wdn.com> wrote:
I'm temporarily stumped on how to handle/suppress an error (2501) if a
user cancels sending an email. I'm using DoCmd.SendObject to trigger
an Outlook send window, which works OK, but if the msg is cancelled
(not sent) then a VB runtime error msg appears (#2501) that I would
like to either hide or deal with.
-Ed


Your first line of code should be an 'On Error GoTo' statement. You can
then handle the error thus:

If Err.Number = 2501 Then
Exit Sub
Else
Beep
MsgBox Err.Number & ", " & Err.Description
End If

Don't forget the 'Exit Sub' before the error handler too.

Keith.
www.keithwilby.com

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
1
by: Abby | last post by:
Hi ... when I run my program, it produces error. I would like to know how to handle this error message. I don't want to see it on screen. Any way to just ignore it? Please let me know. Thanks a...
5
by: David | last post by:
I'm developing an ASP.NET application to run on Win2K server with IIS 5.1, which has run perfectly happily in various development, test and staging environments. I've recently deployed it on one...
2
by: ajain1008 | last post by:
I'm running the following code on asp.net form Dim objExcel As Excel.Application Dim objWrkBk As excel.Workbook objExcel = New excel.Application objWrkBk =...
0
by: bazzer | last post by:
hey, i am using visual basic.net 2003 and have an ASP.NET webform application thats accessing a microsoft access 2003 database. i kept getting the following error when i tried to run it: ERROR ...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
1
by: shef1 | last post by:
Hi All, I am consuming a third party web service.I am getting "access forbidden 403 error web service eror".Can anyone help me. Thanks
1
by: Chetana | last post by:
Hi All, I have one asp.net application in which connection gets expired after some time on my server actually i m thinking on how the connection gets removed because after some time I m getting...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.