I have the follwoing code that sneds me an email about an appointment that has been scheduled for an employee (say a review or something)
Private Sub EmailLineManager()
Dim objMail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.Application")
.Subject = "Appoinment added for " & Forms.frmEmployeeDetails.tboRvwFullName
.Body = "An appointment has been scheduled for " & Forms.frmEmployeeDetails.tboRvwFullName _
& " for " & Me!ApptDate & " at " & Me!ApptTime & ", lasting about " & Me!ApptLength _
& vbCrLf & vbCrLf _
& "The reason for this appointment is " & Me!Appt & "."
Set objMail = Nothing
I have in my form a Combo Box that lists the employees line manager (not me). When I call this routine, I want to send an email not only to this employees line manager, but to all line managers in the same Department. I have in my line managers table a field called DeptCode, so lets say PersonA and PersonB are in department HD, but Person C in in department CS.
Assuming that this employee reports to PersonA, in the .Recipients.Add line I would like to add not only the employees line manager (PersonA n department HD), but also PersonB, but not PersonC.