Solved

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

Posted on 2010-09-01
2
708 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
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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 …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now