Emailing reports

G

Guest

Hello,

I have a question that I hope someone has an answer for...

I have a mdb that works just fine, I am going to put it on the company
website so that remote users can access it via secure login.

It has a form that gathers information for the reports and an area of check
boxes that allows the user to choose which reports to print, and one button
that prints the specified reports

the question I have is, is there a way to set up access to print at the
location that is inputing and have the reports that are being printed emailed
to specific recipients within the same button?

I would like this to be fool proof with little or no action from the user
other than the button click.

Thanks in advance =0)
 
S

strive4peace

Hi Paul,

one way is to use

DoCmd.SendObject
[objecttype]
[, objectname]
[, outputformat]
[, to]
[, cc]
[, bcc]
[, subject]
[, messagetext]
[, editmessage]
[, templatefile]

this sub would go into a general module:

'------------------------------------ EMailReport
Sub EMailReport(pReportName As String, _
pEmailAddress As String, _
pFriendlyName As String, _
pBooEditMessage As Boolean, _
pWhoFrom As String)

'Email a report to someone
' and construct the subject and message
'SNAPSHOT Format

'example useage:
'on the command button code to process a report
' EMailReport "rptSonglist", _
"(e-mail address removed)", _
"List of the Original Songs ", _
false, "John Doe"

'PARAMETERS
'pReportName --> "rptSonglist"
'pEmailAddress --> "(e-mail address removed)"
'pFriendlyName --> "List of the Original Songs"
'pBooEditMessage
' --> true to edit the message before mail is sent
' --> false to send automatically
'pWhoFrom --> "Susan Manager"

On Error GoTo EMailReport_error

DoCmd.SendObject acSendReport, pReportName, _
acFormatSNP, pEmailAddress, _
, , pFriendlyName _
& Format(Now(), " ddd m-d-yy h:nn am/pm"), _
pFriendlyName & " is attached --- " _
& "Regards, " & pWhoFrom, pBooEditMessage

EMailReport_exit:
Exit Sub

EMailReport_error:
MsgBox Err.Description, , _
"ERROR " & Err.Number & " EMailReport"
'press F8 to find problem and fix
' -- comment out next 2 lines when code is done
Stop
Resume

resume EMailReport_exit

End Sub
'------------------------

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

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

Top