DoCmd.SendObject Method (Access) acFormatPDF File Name Change (1 Viewer)

lhooker

Registered User.
Local time
Today, 02:48
Joined
Dec 30, 2005
Messages
399
Is there any way to change the .PDF file name from the number "1" to a name that I will give with the DoCmd.SendObject method (Access) acFormatPDF parameter ? Right now the attached file is named '1.PDF'.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:48
Joined
Oct 29, 2018
Messages
21,473
What object are you sending? Is it a report? Can you show us your code?
 

lhooker

Registered User.
Local time
Today, 02:48
Joined
Dec 30, 2005
Messages
399
I'm sending a report. Below is the code.

DoCmd.SendObject acSendReport, sRep, acFormatPDF, sAddr, , , sSubj, "Thank you for taking this survey. Attached is your copy of " & "'Survey Report'."
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:48
Joined
Oct 29, 2018
Messages
21,473
I'm sending a report. Below is the code.

DoCmd.SendObject acSendReport, sRep, acFormatPDF, sAddr, , , sSubj, "Thank you for taking this survey. Attached is your copy of " & "'Survey Report'."
So, the report's name is 1? Is that right?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:48
Joined
Oct 29, 2018
Messages
21,473
I'm going to pass it from the form.
Okay, you could try the following code:
Code:
DoCmd.OpenReport "1", acViewPreview, , , acHidden
Reports![1].Caption = Forms!FormName.TextboxName
DoCmd.SendObject acSendReport, sRep, acFormatPDF, sAddr, , , sSubj, "Thank you for taking this survey. Attached is your copy of " & "'Survey Report'."
DoCmd.Close acReport, "1"
(untested)
Hope that helps...
 

lhooker

Registered User.
Local time
Today, 02:48
Joined
Dec 30, 2005
Messages
399
I misread your question. The report name is not "1". I'll try the code tomorrow and get back to you. Thanks ! ! !
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:48
Joined
Oct 29, 2018
Messages
21,473
I misread your question. The report name is not "1". I'll try the code tomorrow and get back to you. Thanks ! ! !
Okay, let us know how it goes. Good luck!
 

lhooker

Registered User.
Local time
Today, 02:48
Joined
Dec 30, 2005
Messages
399
Update . . . My e-mail finally arrived (hours later). It appears that when sending the MS Access e-mail with an attachment, the attachment has a filename of "#1.PDF", but when the reaches it's designation, it has my specified filename. Weird . . . Have heard of this before ? Now, I have to figure out why the delay with this MS Access e-mail. Thanks the alternate solution ! ! !
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:48
Joined
Sep 21, 2011
Messages
14,299
You could copy the report to a new name and send that?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:48
Joined
Oct 29, 2018
Messages
21,473
Update . . . My e-mail finally arrived (hours later). It appears that when sending the MS Access e-mail with an attachment, the attachment has a filename of "#1.PDF", but when the reaches it's designation, it has my specified filename. Weird . . . Have heard of this before ? Now, I have to figure out why the delay with this MS Access e-mail. Thanks the alternate solution ! ! !
That sounds weird, but I can't say anything for sure without seeing your environment. Hope you find the answer soon.
 

Users who are viewing this thread

Top Bottom