Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2010-09-01
2
Medium Priority
?
969 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

810 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