Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
renaming email attachments
Mark Budinger 
     
3 years ago
I have an email button on my form that when pressed it will attach the report as a pdf and then all I have to do from there is choose who I want to send it to.  Is there a way to change the below code for the report to be called something else? for example I have a filed called [QuoteNumber] I would like for attachment to be called Quotation-[QuoteNumber] Quotation-634.pdf. Or is there a way to use strDocname as the name of the pdf to attach?

Private Sub cmdEMail_Click()


Dim strDocname As String
    Dim strMsgBody As String
    Dim strSubject As String
          

strDocname = "Quote" & "-" & {QuoteNumber)
strSubject = "Quote" & "-" & {QuoteNumber)
strMsgBody = "Find attached a new Quote."



DoCmd.SendObject acSendReport, "rptQuote", acFormatPDF, , , , strSubject, strMsgBody, True

End Sub
Kevin Robertson  @Reply  
          
3 years ago
You could rename the report to whatever is in strDocName then change it back to the original name after it has been sent.
Kevin Robertson  @Reply  
          
3 years ago

Mark Budinger OP  @Reply  
     
3 years ago
Hi Kevin,

I tried your suggestion but I error out on the 7th line and acReport is highlighted. Did I do something wrong? I did rename the report to Quotation and I made the proper changes in the VBA to point to the proper report name.

Mark Budinger OP  @Reply  
     
3 years ago
This is what I used

Dim strDocName As String
Dim strMsgBody As String
Dim strSubject As String

strDocName = "Quotation" & "-" & QuoteNumber
strSubject = "Quotation" & "-" & QuoteNumber
strMsgBody = "Find the attached Quotation"

DoCmd.Rename strDocName, acReprot, "Quotation"
On Error Resume Next
DoCmd.SendObject acSendReport, strDocName, acFormatPDF, , , , strSubject, strMsgBody, True
On Error GoTo 0
DoCmd.Rename "Quotation", acReport, strDocName
Mark Budinger OP  @Reply  
     
3 years ago
Hi Kevin,

My fault, I didn't spell acReport correctly.  Your solution worked perfectly.  

Thank you so much for the quick reply

Regards,
Mark

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/7/2026 7:08:18 AM. PLT: 1s