Solved

MS Access - How do you insert a date function in the subject line of the SendObject

Posted on 2010-09-01
2
844 Views
Last Modified: 2012-05-10
I have a macro that uses SendObject to e-mail reports on a monthly basis.  Is there a way to insert the =Date() function or the month part of the date into the Subject line of the SendObject?
0
Comment
Question by:TFHDIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Accepted Solution

by:
hes earned 125 total points
ID: 33580339
Use a variable for your Subject Line

Dim strEmailTO As String
   Dim strEmailCC As String
   Dim strEmailBCC As String
   Dim strSubject1 As String
   Dim strSubject2 As String
   Dim strBodyText As String

'Populate each variable with email addresses or titles
strSubject1 = "This report is for "
strSubject2 = " Date..."


DoCmd.SendObject acSendReport, "Report Name", acFormatRTF, strEmailTO, strEmailCC, strEmailBCC, strSubject1 & " " & Now() & " " & strSubject2 & " ", strBodyText, 0
0
 
LVL 6

Expert Comment

by:PJBX
ID: 33687866
Use a variable and the format comand:
dim strSubject as string
'If you want just the abbreviated month (Ex: Payables report for: Sep)
strSubject = "Payables report for: " & Format(Now(), "MMM")

'If you want the full month (Ex: Payables report for: September)
strSubject = "Payables report for: " & Format(Now(), "MMMM")

0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question