Others

How to Send Access Form Values in an Email Body

Tauseeq MagsiTauseeq Magsi Nov 2, 2026 869 views

Question details

The user wants to successfully include specific text box values from a Microsoft Access form within the body of an automated approval email.

How to Send Access Form Values in an Email Body
Product
Microsoft Access
Device & OS
not provided
Scenario
Triggering an automated email from an Access database form using VBA to request approval.
Observed behavior
The values from the form text boxes are not appearing correctly in the message body; the email incorrectly displays the VBA code syntax rather than the actual text-box contents.
Before you start

Ensure you have your Microsoft Access form open in Design View and take note of the exact names of the text box controls you wish to include in your email.

Solution 1Recommended

Concatenate Form Controls into a VBA String Variable

Build the email body explicitly as a string variable before passing it to the email command, ensuring Access evaluates the form variables as text.

When passing values directly into the DoCmd.SendObject method, the syntax can become confusing, causing Access to output raw code instead of the evaluated data. By explicitly building the email body as a string variable first and utilizing standard VBA string concatenation, you ensure that the text box data is correctly parsed.

1
Open the VBA Editor

In your Access form's Design View, right-click the button used to send the email, select 'Build Event...', and choose 'Code Builder' to open the VBA editor.

2
Force the Record to Save

Before generating the email, add a command to save any pending changes on the form so the email captures the latest data. Type: If Me.Dirty = True Then Me.Dirty = False

3
Declare and Build the String Variable

Create a string variable using concatenation (the & symbol) to link standard text with your form control values. For example: strBody = Me.txtFirstName & " " & Me.txtLastName & " is requesting a Grand Master Key. Do you approve?"

4
Verify Using Debug.Print

Add the line Debug.Print strBody right after your string declaration. You can open the Immediate Window (Ctrl+G) to verify that the generated text evaluates correctly before sending.

5
Pass the String to SendObject

Finally, use the string variable in your email command: DoCmd.SendObject acSendNoObject, , , "approver@example.com", , , "Approval Request", strBody, True

Concatenate Form Controls into a VBA String Variable
Syntax Tip: Always ensure that your literal text is enclosed in quotation marks, but your form variables (like Me.txtFirstName) are outside the quotation marks, linked by an ampersand (&).
Free Microsoft Office alternative

Looking for a Free Office Suite? Try WPS Office

While Microsoft Access is highly specialized for database management, you may also need reliable software for word processing, spreadsheets, and presentations. WPS Office is a lightweight, intuitive, and highly compatible alternative to Microsoft Office that is entirely free to use.

  1. 1. Visit the Official Website: Go to the WPS Office website to find the free download link.
  2. 2. Download and Install: Click the download button for your operating system and run the quick installer.
  3. 3. Open and Edit: Launch WPS Office and immediately start working on your documents, spreadsheets, or PDFs seamlessly.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats.Lightweight architecture ensures fast launch times and smooth operation on any device.Familiar user interface allowing for a seamless transition from Microsoft Office.Built-in robust PDF editing, merging, and conversion features at no extra cost.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Access email body show the VBA code instead of the text box values?

This usually happens when form variables are placed inside quotation marks. VBA treats everything inside quotes as literal text. To fix this, place variables outside the quotes and connect them to the text using an ampersand (&).

Do I need to save the Access form before triggering the email script?

Yes. If a user has typed in a text box but the record hasn't been saved, the VBA script might pull outdated or blank information. Adding 'If Me.Dirty = True Then Me.Dirty = False' ensures all current inputs are saved to the record before the email is generated.

Can I use TempVars to pass form values to an email body in Access?

Yes, TempVars can be used, but you still need to concatenate them properly into a string variable. If you don't use proper concatenation, the email body will output the TempVars syntax rather than the actual values stored inside them.