Email Macro - Access 2013

snowlep

New member
Local time
Today, 02:43
Joined
Aug 2, 2013
Messages
6
I have created a button on my form to email a report. Is it possible to email more than one report with that button?

In the macro for on click it has a line 'Object Name' for the report name. Maybe additional reports could be added there.

Thanks in advance.
 
I have changed the buttons with this procedure:

Private Sub Command19_Click()
Dim stDocName As String

stDocName = "Report Name"
DoCmd.OpenReport stDocName, acPreview, , "[RecordID] = " & Me.RecordID
DoCmd.SendObject acSendReport, "Report Name", acFormatPDF, , , , , False

End Sub

*****************************

This works great for individual buttons for each current report.

My question now is can these buttons be password protected so only certain users can email the reports?

Thanks very much for any help.
 
At the simplest:

Code:
Dim stDocName As String
Dim stPassword as String

stPassword = InputBox("Enter Password")

If stPassword = "the correct password" Then
  stDocName = "Report Name"
  DoCmd.OpenReport stDocName, acPreview, , "[RecordID] = " & Me.RecordID
  DoCmd.SendObject acSendReport, "Report Name", acFormatPDF, , , , , False
End If

In answer to your earlier question, SendObject can only send 1 report. You can send multiple with other methods, like automation:

http://support.microsoft.com/?kbid=161088
 
Happy to help, and welcome to the site by the way!
 
Thanks for the help and for the welcome!

I didn't quite understand enabling one button for 2 or more reports but it's okay having separate buttons.
 
To attach multiple reports you'd have to export the reports to files first (OutputTo), then attach those files to the email created by automation (or other method).
 
Okay I will keep that in mind as another option.

Have a good one and thanks again.
 

Users who are viewing this thread

Back
Top Bottom