Home  Fees/Services  Microsoft Access Templates  Tutorials  Tutorial Download  Articles  Search  Contact  Privacy  Links
Sending Reports in Email to MS Outlook
Report Sent Via Email Attachment
Report Sent Via Email Attachment  
 




Email Report Attachment from VBA

Send Microsoft Access Report as Outlook or Other Email Attachment

Here is a simple method for mailing an Access report to someone as an attachment. This VBA example uses the docmd.sendobject to email the report in rich text format (RTF). This method should work with any email program running on your PC and should also work for sending a PDF email attachment.  The VBA programming code follows:

Public Sub MailIt()

On Error GoTo Error_MailIt

Dim Rst As Recordset

open the table that the report reads to make sure there is a record in it.

Set Rst = CurrentDb.OpenRecordset("EmailRpt", & _ DB_OPEN_DYNASET)

If Not Rst.BOF Then

    DoCmd.SendObject acReport, "RptEmailAdjustment", & _
    "rich text format (*.rtf)", strEmailAddressGlobal, , , & _
    StrSubjectGlobal ,  StrMessageGlobal

End If

    Goto OK_Exit:

Error_MailIt:

    MsgBox Error$ & " MailIt " GoTo Exit_MailIt

    Resume OK_Exit

OK_Exit:

    Rst.Close

    Set Rst = Nothing

End Sub

More recent versions of Access give you the ability to output reports in PDF format directly.  This makes it much easier to send reports since almost everyone is used to opening PDF attachments in their emails.

 









A Blue Claw Database Design Article:

Why Choose Microsoft Access
 





Blue Claw Database Design Downloadable Tutorial:
DoCmd.OpenForm & OpenArgs VBA Example.  





A Blue Claw Database Design Template:

Real Estate Marketing Campaign System
 





Contact Information

Copyright 2000-2012 Blue Claw Database Design, LLC

VBA Tutorials:
VBA Access-Google Earth
VBA Age Calculation
VBA Change Case
VBA Email via Gmail
VBA Outlook Email
VBA Read Email Access
VBA Email Attachment
VBA Send Outlook Email
VBA Running Sum
VBA Concatenate Records
VBA Stock Quotes
VBA CreateQueryDef
VBA Find Database Path
VBA Detail-Master Update
VBA Data Validation
VBA Field Value New-Old
VBA FindFirst
VBA Access Version
VBA Global Variable Parameter
VBA Global Variables
VBA Active Labels
VBA Files List Box
VBA Mail Merge
VBA Quick Sort
VBA Recordset Filters
VBA Reference Form Field
VBA Select Case
VBA Access Transactions


Visual Basic Function Examples