Mailing Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have set-up some code to help me mail my reports to various parties. I
have had to do this in VB, as i wanted to add spaces between lines in the
body of the e-mail.

I now have a new issue:

1. If a report has no records how can i set the code up to either bring up
an error message or to send a seperate message saying "No transactions"
 
Reports have a NoData event.
If you cancel this event, the report does not open.

In the code that uses OpenReport, trap error 2501.
In your error trapping, send the separate message.
To send that as an email, use SendObject with acNoObject
 
Sorry a slight mistake on my part. I actually sending Queries as apposed to
reports. The code i am using is as below. Is there away of adding the
nodata function to this?


Dim strMsg As String

strMsg = "All, " & vbCrLf & vbCrLf & "Please find attached today's report." _
& vbCrLf & vbCrLf & "If you require any further information, please do not
hesitate to contact me." _
& vbCrLf & vbCrLf & "Regards" & vbCrLf & vbCrLf & ""


DoCmd.SendObject acSendQuery, "Portfolio", acFormatXLS, _
"Name", , , "Sales", (strMsg), True
 
Could you use a domain function

Records = Dcount("*", "Portfolio")
If Records > 0 Then SendQuery

Peter Kinsman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top