Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendobject emails message but I don't want duplicate recipients

Status
Not open for further replies.

triffe

Technical User
Jun 21, 2001
20
0
0
US
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
 
Won't this work?

if CPPLname = CBMLname then
strPartner= CPLLname
else
strPartner=CPLLname & ", " & CPMLname
endif
' 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

DoCmd.SendObject acSendNoObject, , acFormatTXT, strAssigned & ", " & strPartner, , , strCltname, "A routing guide has been created for client " & strCltnum & " " & strCltname & ".", True
John Ruff - The Eternal Optimist :)
 
Thanks so much for your help! It works beautifully now!:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top