How to Send an Email with a PDF Attachment from an Access Form Using VBA
Question details
The user wants to construct and send an email with a PDF attachment by clicking a button on a Microsoft Access form, utilizing form data for the recipient, subject, and message.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Automating Outlook emails from Microsoft Access via VBA, extracting string values from specific form fields and attaching a generated PDF file.
- Observed behavior
- The VBA code may execute without opening an email if display commands are missing, or it may throw an 'Object doesn't support this property or method' error when referencing label controls incorrectly.
Verify that Microsoft Outlook is installed and configured with an active email account on your machine, as the VBA automation script relies on the local Outlook application.
Use Outlook Automation with Proper Control References
Automate Outlook via VBA to create an email and attach a generated PDF, ensuring that Access form labels are correctly referenced by their caption property.
When referencing label controls in Access VBA, they do not possess a default value property like text boxes do. You must explicitly specify the `.Caption` property to extract their text, otherwise you will encounter an 'Object doesn't support this property or method' error.
Start your VBA sub with 'Me.Dirty = False' to ensure all recent changes made on the active form are saved to the database before generating the attachment.
Define your variables and pull data from the form using the caption property. For example, use 'strTo = Me.Eml_Label.Caption' and 'strSubject = Me.JobNum_Label.Caption'.
Initialize the Outlook application using 'CreateObject("Outlook.Application")' and create a new mail item.
Inside your 'With OutMail' block, configure '.To', '.Subject', and '.Attachments.Add'. Most importantly, ensure you include the '.Display' (to review before sending) or '.Send' (to send immediately) command so the action executes visibly.

Use DoCmd.SendObject to Email an Access Report as PDF
A simpler alternative using built-in Access macros that exports and attaches a report directly as a PDF without requiring complex Outlook objects.
Looking for a Free Office Suite? Try WPS Office
While Microsoft Access is used for database management, if you frequently work with Word documents, Excel spreadsheets, PowerPoint presentations, and PDF files, WPS Office is an exceptional free alternative. It provides native PDF editing and powerful document tools in one lightweight app.
- 1. Download the software: Visit the WPS Office website and download the free installer package for your operating system.
- 2. Install WPS Office: Run the setup file and follow the on-screen instructions to install the comprehensive office suite.
- 3. Manage documents and PDFs: Open the application to seamlessly create, edit, and manage all your office files and PDFs from a single workspace.

Frequently Asked Questions
Why do I get an 'Object doesn't support this property' error when extracting email addresses from Access labels?
This error occurs because label controls do not have a default 'Value' property. You must explicitly reference their caption to extract text, for example: Me.YourLabelName.Caption.
Why does my VBA Outlook code run but no email is generated?
If no email window appears and nothing is sent, you likely missed the trigger commands inside your Outlook automation block. Ensure you call '.Display' to open the draft or '.Send' to dispatch it directly.
Should I save the current Access record before sending the email attachment?
Yes, it is highly recommended to include 'Me.Dirty = False' at the beginning of your script. This forces Access to save the current record to the database, ensuring any newly entered form data is included in the attached PDF.




