I thought you wanted to send multiple emails because of the original looping code. And I see you still have a variable for strAddresses. So what do you want? Do you want the data for a single record sent to multiple addresses?
The popup form is allowing edit of record in [Change Request] table. I still don't understand what data is not being saved. It works for me after the edits already described.
If you want this code to send a single email with the data of the current record on the popup form, can simply set the popup form RecordSource to the AORB_Email query (without the static parameters) and the VBA doesn't even need to open a recordset, just reference the fields of the form RecordSource and set the email address argument of SendObject with an address.
Code:
Private Sub Send_AORB_OOB_Click()
On Error GoTo Error
Dim strSubject, strBody, strAddresses As String
DoCmd.RunCommand acCmdSaveRecord
With Me
If Not IsNull(.cbxNumber) And Not IsNull(.Priority) And Not IsNull(.Hours) Then
strBody = "Action Officers," & vbCrLf & "This is a follow-on from today's ERB discussion on CR " _
& !CR_Numbers & ". If needed, please back-brief your O6 for SA, and let me know if there are any issues or concerns. " _
& "The Change Request priority is " & !Priority & " with " & !Hours & " hours until CR is automatically approved. " _
& "Please provide your votes NLT " & !Time & ". Please call if you have any questions or issues." & vbCrLf & vbCrLf & vbCrLf
strBody = strBody & "Priority: " & Chr(9) & Chr(9) & Chr(9) & Chr(9) & !Priority & vbCrLf
strBody = strBody & "CR Number: " & Chr(9) & Chr(9) & Chr(9) & Chr(9) & !CR_Numbers & vbCrLf
strBody = strBody & "Date Issue Identified: " & Chr(9) & Chr(9) & Chr(9) & !Dates & vbCrLf & vbCrLf
strBody = strBody & "Change Requested: " & Chr(9) & ![Change Requested] & vbCrLf & vbCrLf
strBody = strBody & "Unit & Section: " & Chr(9) & Chr(9) & Chr(9) & !UNITS & vbCrLf
strBody = strBody & "MTOE Para & Bumper Number: " & Chr(9) & ![MTOE Paras] & vbCrLf & vbCrLf
strBody = strBody & "Rationale: " & Chr(9) & Chr(9) & !Rationale & vbCrLf & vbCrLf
strBody = strBody & "Notes: " & Chr(9) & Chr(9) & Chr(9) & !NOTES & vbCrLf
strBody = strBody & "Action Items: " & Chr(9) & Chr(9) & !Action_Items & vbCrLf & vbCrLf & vbCrLf & vbCrLf
strBody = strBody & "V/R" & vbCrLf & vbCrLf
strBody = strBody & "Configuration Management" & vbCrLf
strBody = strBody & "Brigade Modenerzation Command (BMC)" & vbCrLf
strBody = strBody & "Network Integration Division (NID)" & vbCrLf
strBody = strBody & "BLDG 2, Sheridan Road" & vbCrLf
strBody = strBody & "Ft Bliss, TX 79916" & vbCrLf
strBody = strBody & "Amanda Fallin" & Chr(9) & "(915)568-8442" & Chr(9) & "address" & vbCrLf
strBody = strBody & "Kathy Gordon" & Chr(9) & "(915)569-5167" & Chr(9) & "address" & vbCrLf
strSubject = !Priority & " OOB AORB Change Request Number " & !CR_Numbers & " - " & ![Change Requested]
'If you want to send this same record data to multiple addresses, this is where the looping code is needed to build address string.
'And this is what a recordset object will be needed for.
Dim rstCR As Recordset
Set rstCR = CurrentDb.OpenRecordset("SELECT [email address field] FROM [some table/query with email addresses] WHERE some criteria here;", dbOpenDynaset)
While Not rstCR.EOF
strAddresses = strAddresses & [email address field] & ","
rstCR.MoveNext
Wend
strAddresses = Left(strAddresses, Len(strAddresses) - 1)
DoCmd.SendObject acSendNoObject, , acFormatTXT, strAddresses, , , strSubject, strBody, True
End If
End With
Error_Handler_Exit:
Exit Sub
Error:
Select Case Err.Number
Case 2501
Err.Clear
Resume Error_Handler_Exit
Case Else
MsgBox "Error No. " & Err.Number & vbCrLf & "Description: " & Err.Description, vbExclamation, "Database Error"
Err.Clear
Resume Error_Handler_Exit
End Select
Exit Sub
End Sub
Is this word correctly spelled: Modenerzation
Should it be: Modernization