How to Send an Access Email with Two PDF Attachments via VBA
Question details
The user needs to send a single email containing two PDF attachments from Microsoft Access using a command button.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Automating email generation triggered by an Access command button, where multiple reports or documents need to be attached to the same email.
- Observed behavior
- The standard DoCmd.SendObject method currently implemented only allows for a single PDF attachment, preventing the user from attaching the second required PDF to the same email message.
Ensure you have Microsoft Outlook installed and configured with an active email profile on your computer, as handling multiple attachments requires utilizing the Outlook application object via VBA.
Use Outlook Automation to Attach Multiple PDFs
Since DoCmd.SendObject is strictly limited to a single attachment, utilizing Outlook Automation allows you to create a custom email object and add as many attachments as needed.
Outlook Automation involves creating a link between MS Access and MS Outlook using VBA. By creating an Outlook Application object and generating a MailItem, you gain full control over the email's properties, including the ability to run the Attachments.Add method multiple times.
Press Alt + F11 while in Microsoft Access to open the Visual Basic for Applications (VBA) Editor.
In the top menu, click Tools and select References. Scroll down the list, check the box for Microsoft Outlook XX.X Object Library (where XX.X is your version number), and click OK.
In your command button's click event, define your variables: Dim objOutlook As Outlook.Application and Dim objMail As Outlook.MailItem. Then, instantiate them using Set objOutlook = New Outlook.Application and Set objMail = objOutlook.CreateItem(olMailItem).
Use the Attachments.Add method on your objMail object for each PDF you want to include. For example, call objMail.Attachments.Add followed by the exact file path of your first PDF, and repeat the command on the next line for your second PDF.
Set the email recipient using objMail.To and the subject using objMail.Subject. Finally, use objMail.Display to review the email before sending, or objMail.Send to dispatch it automatically.

Send Two Separate Emails Using DoCmd.SendObject
If you prefer not to use Outlook Automation or do not have Outlook installed, you can use the DoCmd.SendObject method twice as a workaround to send two separate emails.
Looking for a Lightweight, Macro-Enabled Office Suite?
While Microsoft Access handles complex databases, WPS Office offers a highly compatible, free alternative for your daily document, spreadsheet, and presentation needs. It supports advanced VBA macros in Spreadsheets, making data automation seamless without the heavy resource requirements.
- 1. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Open Your Existing Files: Launch WPS Office and seamlessly open your legacy Word documents, Excel spreadsheets, and PDFs without formatting loss.
- 3. Run VBA Macros: Access the Developer tab in WPS Spreadsheets to write, edit, and execute your macro scripts efficiently.

Frequently Asked Questions
Why does DoCmd.SendObject only allow one attachment?
The DoCmd.SendObject method is a legacy Access function designed for quick, simple messaging. It inherently limits output to a single database object or report per execution, making it impossible to append additional files natively.
Can I use Outlook Automation to send emails without user intervention?
Yes, you can automate the process entirely. By using the .Send method instead of .Display in your MailItem VBA code, the email will be routed directly to your Outlook Outbox without popping up on the screen.
How do I add the Outlook Object Library reference in MS Access?
Open the VBA Editor by pressing Alt + F11, click on Tools in the top menu, select References, scroll down the alphabetical list, and check the box next to Microsoft Outlook [Your Version] Object Library. Click OK to save.
Is it possible to attach non-PDF files using Outlook Automation?
Absolutely. The Attachments.Add method in Outlook Automation accepts valid file paths for any file type, including Excel spreadsheets, Word documents, images, and text files.




