VBA & Macro Problems

How to Send an Email with a PDF Attachment from an Access Form Using VBA

Steven ParkerSteven Parker Nov 3, 2026 869 views

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.

How to Send an Email with a PDF Attachment from an Access Form Using VBA
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.
Before you start

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.

Solution 1Recommended

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.

1
Save the current record

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.

2
Reference form labels correctly

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'.

3
Create the Outlook object block

Initialize the Outlook application using 'CreateObject("Outlook.Application")' and create a new mail item.

4
Add Display or Send methods

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 Outlook Automation with Proper Control References
Error Handling Recommendation: Always add basic error handling routines (such as On Error GoTo ErrorHandler) when working with Outlook automation to easily trace execution failures.
Free Microsoft Office alternative

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. 1. Download the software: Visit the WPS Office website and download the free installer package for your operating system.
  2. 2. Install WPS Office: Run the setup file and follow the on-screen instructions to install the comprehensive office suite.
  3. 3. Manage documents and PDFs: Open the application to seamlessly create, edit, and manage all your office files and PDFs from a single workspace.
Highly compatible with Microsoft Excel, Word, and PowerPoint formatsBuilt-in advanced PDF editor for viewing, editing, converting, and splitting PDFsLightweight application that runs smoothly across Windows, Mac, Linux, and mobileFree to download with a familiar, easy-to-use tabbed interface
QA img-9

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.