Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Report via Outlook

Status
Not open for further replies.

nat1967

Technical User
Feb 13, 2001
287
US
HI group,

I have been using Docmd.sendObject to send reports. However, my users have just told me of a problem and I am having difficulty resolving.

If the report has no data, the action of ".SendOject" is canceled by Access. Then when the users try to reselect and send another report, Access gives this error:

2501 Docmd.SendOject Canceled

hmmm... yes, it was canceled. Canceled by Access. The users have to completely exit and reenter the database before it will allow them to send the other report. What a pain in the ***. :)

I am aware of the security patch that limits how many emails can be sent. These pcs do NOT have the patch installed. I have already verfied that.

I have tried:

err.clear

err.clear w me.refresh, me.requery, me.repaint

(as you can see, i am grasping at anything!)

anyway, I then tried to setup a reference to Outlook but realized I didnt know how to attach an Access report. I have attached files from harddrives but never used it to attach Access reports. I have always used .SendObject.

Does anyone know how to can handle the 2501 Docmd.Sendobject canceled error or how to attach an Access report to an Outlook email (.rtf format or .doc)?

Any and all suggestions are greatly appreciated. Nathan
Senior Test Lead
 
Hi

Just trap the 2502 error in code and resume your code at the appropriate point Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Sorry, should have said

Just trap the 2501 error in code and resume your code at the appropriate point Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Hi Ken,

I have trapped the error but that hasnt helped.

'*********************
On Error GoTo err_handler:
Dim strmessage As String

strmessage = "Hello," & Chr(13)
strmessage = strmessage & " Attached is a copy of the Feature " & cboFeature & " report." & Chr(13)
strmessage = strmessage & " Please let me know if you have any questions." & Chr(13)

DoCmd.SendObject acSendReport, "rpt_feature", acFormatRTF, , , , "Feature " & cboFeature & " Report", strmessage, True

Exit Sub

err_handler:
If Err.Number <> 2501 Then

MsgBox Err.Number & &quot; &quot; & Err.Description

End If

Resume Next

Exit Sub

End Sub
'********************

Any thoughts?

I just didnt think this would be a whole day thinker, ya know. :) Nathan
Senior Test Lead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top