Can A Report Name Be Changed Before Attaching in Auto-Email? (1 Viewer)

Ashfaque

Student
Local time
Tomorrow, 03:12
Joined
Sep 6, 2004
Messages
894
Hi,

I have below code that send my report to receiver that successfully executes. My question is can I change report name before attaching in email and then attach?

DoCmd.SendObject acSendReport, "R_IssuedWarnings", acFormatPDF, strMailList, StrCC, , "WARNING LETTER FOR " & X & " # " & XX & " - " & WLetterRef & _
"", "Dear " & CName & "," & vbCr & vbCr & "With reference to the subject, " & _
"a disciplinary action has been taken against you for your recent " & Y & ". " & "The details are attached." & vbCr & vbCr & "If you have anything to " & _
"explain, you may visit to HR office." & vbCr & vbCr & "Regards," & _
vbCr & vbCr & "Sincerely," & vbCr & vbCr & "John Smith" & vbCr & "HR Manager", True

The above is fine to send report R_IssuedWarnings thru the email. But I need to change name as each warning letter has different name.

I am success in changing report name at view - I used below code line.
Reports!R_IssuedWarnings.Caption = X & " # " & Me.WCounter

X is Criteria like (LATES or ABSENT or MISCONDUCT) generating somewhere and Wcounter is number. - This has no issue in viewing report on screen with generated name but I need the same for the attachment while sending email.

Any idea?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:42
Joined
Oct 29, 2018
Messages
21,469
Hi. Yes. All you have to do is open the report first and then assign a new caption to it before sending the email.
 

Ashfaque

Student
Local time
Tomorrow, 03:12
Joined
Sep 6, 2004
Messages
894
Woow......wonderful.....Thanks theDBguy...... (y)
 

Users who are viewing this thread

Top Bottom