I have created a report in Access that after it is run, will send an email message to various recipients depending on the parameters set when the report was run. The recipients for the email are the partner, the biller, and the person assigned to the job. It is working great, but if the same person is the partner and the biller on the job, it puts their name in twice on the "To" line. Right now, I have it set to show me the email before sending it, so I can just take out the duplicate. But I know there is a way to put something in the code to check for duplicate names. I don't know much about code at all and struggled just to get the email part working. Any help would be greatly appreciated!
Here's the code:
Private Sub Report_Close()
Dim db As Database
Dim strPartner As String
Dim strBiller As String
Dim strAssigned As String
Dim strCltnum As String
Dim strCltname As String
Set db = CurrentDb
strPartner = [CPPLname]
strBiller = [CBMLname]
strAssigned = [CBudEmpLName]
strCltnum = [Client No]
strCltname = [Cltname]
DoCmd.SendObject acSendNoObject, , acFormatTXT, strAssigned & ", " & strPartner & ", " & strBiller, , , strCltname, "A routing guide has been created for client " & strCltnum & " " & strCltname & ".", True
End Sub
Here's the code:
Private Sub Report_Close()
Dim db As Database
Dim strPartner As String
Dim strBiller As String
Dim strAssigned As String
Dim strCltnum As String
Dim strCltname As String
Set db = CurrentDb
strPartner = [CPPLname]
strBiller = [CBMLname]
strAssigned = [CBudEmpLName]
strCltnum = [Client No]
strCltname = [Cltname]
DoCmd.SendObject acSendNoObject, , acFormatTXT, strAssigned & ", " & strPartner & ", " & strBiller, , , strCltname, "A routing guide has been created for client " & strCltnum & " " & strCltname & ".", True
End Sub