rename attachment

R

rml

I have a form with a command button with the following code. When I click
the button, it sends a specific record to my e-mail called "Reportpdf" and it
works fine.
My question is this: How can i make the attachment have a different name
based on a field value. For instance, if the specific record had an id
(1234) number unique to that record, then I would like the attachment to be
named 1234.pdf. Is this possible?
I know it needs to open the "Reportpdf" form but can it be renamed?

Thanks.


DoCmd.SendObject acSendForm, "Reportpdf", acFormatPDF, Me![cemail],
Me![demail], "(e-mail address removed)", "Results - ID Number ",
"Attached are your results for Report ID - "
 
R

rml

That worked perfect! Thank You.

Dale_Fye via AccessMonster.com said:
I think you can do this by opening the report hidden prior to using
SendObject. Then, set the reports caption to the value of the ID. something
like:

docmd.OpenReport "ReportPDF", acViewPreview, , , acHidden
Reports("ReportPDF").Caption = me.ID & ".PDF
DoCmd.SendObject acSendForm, "Reportpdf", acFormatPDF, Me![cemail], _
Me![demail], "(e-mail address removed)", "Results - ID Number
", _
"Attached are your results for Report ID - " &
me.ID

HTH
Dale
I have a form with a command button with the following code. When I click
the button, it sends a specific record to my e-mail called "Reportpdf" and it
works fine.
My question is this: How can i make the attachment have a different name
based on a field value. For instance, if the specific record had an id
(1234) number unique to that record, then I would like the attachment to be
named 1234.pdf. Is this possible?
I know it needs to open the "Reportpdf" form but can it be renamed?

Thanks.

DoCmd.SendObject acSendForm, "Reportpdf", acFormatPDF, Me![cemail],
Me![demail], "(e-mail address removed)", "Results - ID Number ",
"Attached are your results for Report ID - "
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

pdf send 8
e-mail code 2
Access Form Issue 1
Report attachment to email 1
On Click Function Open Different Forms 9
Access Manage Attachments linked to a SubForm 0
send object (current record) 1
send an object as an attachment 1

Top