We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Option Compare Database Function send_emailcap_mtd() On Error GoTo Err_Send_Click Dim mydb As Database, RS As Recordset Set mydb = DBEngine.Workspaces(0).Databases(0) Dim docname As String, ctl As Control, strTo As String Dim path As String, subject As String, body As String Dim attach As String, blnSuccessful As Boolean Application.Echo False 'Get all the email addresses for the daily stat report Set RS = mydb.OpenRecordset("qry_emailcap_mtd") 'Report to run and make a snapshot of the report and put it on the server path = "c:\temp\" docname = "emailcap_mtd" subject = "Email Address Capture Report" body = "Daily Report is Attached" attach = path + docname + ".rtf" 'DoCmd.OpenReport docname, A_PREVIEW DoCmd.OutputTo acOutputReport, docname, acFormatRTF, _ attach, False 'start of pdf change Dim blRet As Boolean Dim attachPDF As String attachPDF = path + docname & ".pdf" ' Call our convert function ' Please note the last param signals whether to perform ' font embedding or not. I have turned font embedding ON for this example. blRet = ConvertReportToPDF(docname, vbNullString, _ attachPDF, False, True, 150, "", "", 0, 0, 0) ' To modify the above call to force the File Save Dialog to select the name and path ' for the saved PDF file simply change the ShowSaveFileDialog param to TRUE. 'end of pdf change 'This loops through all of the email addresses and sends the report to everyone Do Until RS.EOF strTo = RS!Email 'Old format for sending reports with warnings 'DoCmd.SendObject A_REPORT, docname, A_FORMATTXT, strTo, , , "Daily Stat Report", , False 'New way of sending reports without warnings ' blnSuccessful = FnSafeSendEmail(strTo, subject, body, attach, "", "") blnSuccessful = FnSafeSendEmail(strTo, subject, body, attachPDF, "", "") RS.MoveNext Loop 'Clean up process RS.Close DoCmd.Close A_REPORT, docname Set RS = Nothing Set mydb = Nothing exit_send_click: Application.Echo True Exit Function Err_Send_Click: Resume exit_send_click End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|How to I read text a text box using code in another form?||9||61|
|MS Office 2016 Home & Business, Access Runtime 2013, on Citrix?||6||67|
|Access Query function||4||50|
|SQL Server and Access Database (Project Codes) get the next record||43||32|
Join the community of 500,000 technology professionals and ask your questions.