Having an error with automated email.

away2play

New member
Local time
Today, 08:01
Joined
Mar 30, 2001
Messages
6
I've added the following to a form feild named Email so that people can just click on the email address on the for to fire up their default email program with the address, subject and intro text "Dear John" already inputted.

The problem I'm having is that I'm getting a runtime error 2501 when you exit (X) the email without actually sending it. Is there something I need to add to the script below to catch this error without giving an error/debug message everytime as the "you've cancelled your email message" doesn't seem
to work . . .

Thanx in advance.


Private Sub EMail_Click()

DoCmd.SendObject acSendNoObject, ObjectName = stDocName, outputformat:=acFormatRTF, to:=EMail, subject:="RE:", Messagetext:="Dear " &
[ID_FirstName]

Exit_EMail_Click:
Exit Sub

Err_Email_Click:
strMsg = "You have cancelled your Email"
MsgBox strMsg
Resume Exit_EMail_Click

End Sub
 
I don't know if this is the cause of your problem but you have selected acSendNoObject yet passed an objectname and format....
stDocName, outputformat:=acFormatRTF

Remove these if your are not sending an attachment, otherwise select what you are sending.

hth
 
Thanx for the fast reply Kev

I'd done as you said but still get a

runtime error 2501
the sendobject action was canceled
end, debug

when closing the mail window without sending the email, this error message is what i'm trying to get rid of
 
Have you set up error trapping?
Looking at your post it does seem to have error trapping BUT no....On Error Goto line at the beginning. Do you have this at the beginning of your routine? This sould trap you error.
 
D'oh missed that one . . must have deleted it somewhere along the line
frown.gif


Always the simple things one overlooks.

Thanx again Kev
 

Users who are viewing this thread

Back
Top Bottom