Solved

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

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

776 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