e.mail a report (1 Viewer)

rob b

Registered User.
Local time
Today, 16:39
Joined
Sep 28, 2000
Messages
16
When in report preview you can "send" a copy by e.mail. Is there a way that this can be automated so that you could click a button in a form and it will send without previewing the report?
 

BoroLee

Registered User.
Local time
Today, 16:39
Joined
Aug 30, 2000
Messages
90
I have done this using this code :

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim strUsr As String

DoCmd.Close , , acSaveYes
strUsr = InputBox("Who do you wish to e-mail this report to ? : ", "E-mail to ")
DoCmd.SendObject acSendReport, , "SnapShot Format(*.snp)", strUsr, , , "Committee Summary Report", , False


Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

You will be asked who you wish to send the report to, and it will be done.
You may need to play with this a little, and change some of the details to coincide with your database.

HTH,
Lee.
 

Jon.N

Registered User.
Local time
Today, 16:39
Joined
Nov 24, 2000
Messages
43
You can use the maco action SendObject. This is quite a powerful tool that gives many options to design the e-mail or leave the options blank so they are user defined. You can then create a command button that runs the macro or you can run the macro from an event on the form.

[This message has been edited by Jon.N (edited 03-01-2001).]
 

rob b

Registered User.
Local time
Today, 16:39
Joined
Sep 28, 2000
Messages
16
BOROLEE

Thanks for the advice it works great, however if I decide not to send the e.mail at the last minute and close the application an error message comes up about incorrectly closing down the dialog box.
 

Users who are viewing this thread

Top Bottom