rob b
02-28-2001, 03:25 PM
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?
|
View Full Version : e.mail a report rob b 02-28-2001, 03:25 PM 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 03-01-2001, 02:16 AM 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 03-01-2001, 05:58 AM 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 03-07-2001, 01:55 PM 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. |