Automatically Create an Email When a Microsoft Access Field Changes
Question details
The user wants Microsoft Access to prepare an email when a field value changes, using predefined text and a recipient address from the database.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A student’s status changes from in school to out of school on a bound form.
- Observed behavior
- After the changed record is saved, an email should be prepared with the appropriate recipient, subject, and message.
Confirm that the form is bound to a record source and identify the status and email-address control names. Configure a compatible default email client and ensure the database is trusted so its VBA code can run.
Use Access form events and VBA to prepare the email
Compare the old and new status before the record is saved, then create an email after the save succeeds.
The example targets an existing record whose status changes from “in school” to “out of school.” It opens the message for review rather than sending it automatically.
Replace Status and EmailAddress with the names of your bound form controls, and adjust the status values, subject, and message to match your database.
In Microsoft Access, right-click the form in the Navigation Pane and select Design View. Open the Property Sheet, select Form, and choose the Event tab.
Set both Before Update and After Update to [Event Procedure]. Click the build button next to an event to open the form’s VBA module, then add or adapt the following code. If either procedure already exists, merge the relevant statements into it rather than creating a duplicate: Private mPrepareEmail As Boolean Private Sub Form_BeforeUpdate(Cancel As Integer) mPrepareEmail = False If Not Me.NewRecord Then mPrepareEmail = _ (StrComp(Nz(Me!Status.OldValue, ""), "in school", vbTextCompare) = 0) And _ (StrComp(Nz(Me!Status.Value, ""), "out of school", vbTextCompare) = 0) End If End Sub Private Sub Form_AfterUpdate() Dim recipient As String If Not mPrepareEmail Then Exit Sub mPrepareEmail = False recipient = Trim(Nz(Me!EmailAddress.Value, "")) If recipient = "" Then MsgBox "The record has no email address." Exit Sub End If On Error GoTo EmailError DoCmd.SendObject ObjectType:=acSendNoObject, To:=recipient, _ Subject:="Student status update", _ MessageText:="The student's status has changed to out of school.", _ EditMessage:=True Exit Sub EmailError: MsgBox "The record was saved, but the email could not be prepared: " & Err.Description End Sub
Save the form, open it in Form View, and change a test record’s status from in school to out of school. Save the record or move to another record, then check the recipient, subject, and message in the email window.

Work with Office documents in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Microsoft Office formats, making it easy to move document and spreadsheet work across. It does not run Microsoft Access forms or fix Access email automation.

Frequently Asked Questions
Why does the email appear only after I save the record?
The form’s After Update event runs after Access saves the changed record. Save the record or move to another record in Form View to trigger it.
How do I change the recipient address?
In the form’s VBA module, replace EmailAddress with the name of the bound control containing the recipient address. The example reads that value from the current record.
Can Access send the message without opening it for review?
Change EditMessage:=True to EditMessage:=False in the SendObject call. Test first, because the configured email client or its security settings may still prompt or prevent sending.
Why is no email created when I add a new student?
The example checks Not Me.NewRecord in the form’s Before Update event, so it only handles changes to existing records. Adapt that condition if new records should also trigger a message.




