Update: Here's the code that's already attached to cmdEmail:
Private Sub cmdEmail_Click()
If Not IsNull(Forms!frmEvent!txtEventID) Then
If IsNull(Forms!frmEvent!cboSelClient) Then
MsgBox "You must first select a Client in order to perform this action."
Forms!frmEvent!cboSelClient.SetFocus
Exit Sub
Else
End If
If IsNull(Forms!frmEvent!txtEventDate) Then
MsgBox "You must first specify an Event Date in order to perform this action."
Forms!frmEvent!txtEventDate.SetFocus
Exit Sub
Else
End If
If IsNull(Forms!frmEvent!cboSelEventStatus) Then
MsgBox "You must first specify the Event Status in order to perform this action."
Forms!frmEvent!cboSelEventStatus.SetFocus
Exit Sub
Else
End If
Else
End If
Dim db As Database
Dim rst As Recordset
Dim rstEmp As Recordset
Dim CorEmpID As String
Dim CorEventNum As String
Dim CorEmpEmailList As String
Dim CorEventDate As String
Dim CorEventDateShort As String
Dim CorEventTime As String
Set db = CurrentDb
Set rst = Me.RecordsetClone
Set rstEmp = db.OpenRecordset("tblEmployeeAction")
CorEventNum = Nz(Forms!frmEvent!txtEventNumber)
CorEventDate = Format(Nz(Forms!frmEvent!txtEventDate), "Long Date")
CorEventDateShort = Format(Nz(Forms!frmEvent!txtEventDate), "Short Date")
CorEventTime = Format(Nz(Forms!frmEvent!txtValetArrival), "h:nn AM/PM")
rst.MoveFirst
Do While Not rst.EOF
If Not IsNull(rst.Fields("email")) Then
If IsNull(CorEmpEmailList) Or CorEmpEmailList = "" Then
CorEmpEmailList = rst.Fields("email")
Else
CorEmpEmailList = CorEmpEmailList & "; " & rst.Fields("email")
End If
CorEmpID = rst.Fields("EmployeeID")
With rstEmp
.AddNew
.Fields("EmployeeID") = CorEmpID
.Fields("ActionDate") = Format(Now(), "short date")
.Fields("EffectiveDate") = Format(Now(), "short date")
.Fields("ActionTypeID") = 5
.Fields("Remarks") = "Email: #" & CorEventNum & ", " & CorEventDateShort
.Update
End With
End If
rst.MoveNext
Loop
rstEmp.Close
DoCmd.SendObject acSendReport, "rptEventEmail", acFormatRTF, , , CorEmpEmailList, "Event: " & CorEventDate & ", " & CorEventTime, "If you have any questions or believe you have been staffed on this event by error, please immediately call the valet office at (415) 447-1700"
'Error:
'MsgBox ("Either you have not staffed any Employees, or the Employees you have staffed do not have e-maill addresses.")
End Sub
However, it opens up the email, but doesn't put their email addresses in the email form. Their email addresses are on CorEmpEmailList, as well as tblEmployee.
Here is an example of sending a single email. To send multiple emails you would need to loop through a recordset. I would recommend using DAO to open a recordset.
https://www.accessforums.net/import-...tml#post281258
Actually, I realized that it works. I didn't see that all the names of the employees were in the BCC line.