Adding a date to an Access EMailDatabaseObject macro (1 Viewer)

brianborn

Registered User.
Local time
Yesterday, 21:59
Joined
Jul 14, 2011
Messages
38
I would like to add the day of the week and date to the subject/body of an email being sent when a command button is clicked on a form in Access 2010. How is this accomplished?

Attached is a screenshot of the macro.

I converted the macro to VBA, but until I become better familiar with VBA in Access, I would like to stick with macros. I did add the =NOW function to the code and it works, but it also includes the time which I do not want. Also I'm not sure how to add the day of the week.

Any help with this is appreciated.

Code:
Option Compare Database

Function mcr_EmailReport2CS()
On Error GoTo mcr_EmailReport2CS_Err

    DoCmd.SendObject acReport, "rpt_LTL Shipments for CS", _
   "PDFFormat(*.pdf)", "email@domain.com", "", "", _
   "LTL Shipping Report (   )", "Attached is the shipping report for ______", True, ""

    mcr_EmailReport2CS_Exit:
    Exit Function

    mcr_EmailReport2CS_Err:
    MsgBox Error$
    Resume mcr_EmailReport2CS_Exit

End Function
 

Attachments

  • EMailDatabaseObject.jpg
    EMailDatabaseObject.jpg
    48.5 KB · Views: 233

JANR

Registered User.
Local time
Today, 02:59
Joined
Jan 21, 2009
Messages
1,623
Try this in your macro:

Attached is the shipping report for & " " & Weekdayname(Weekday(Date())) & " " & Date()

or

Attached is the shipping report for & " " & Format(Date(),"dddd") & " " & Date()
JR
 
Last edited:

brianborn

Registered User.
Local time
Yesterday, 21:59
Joined
Jul 14, 2011
Messages
38
Try this in your macro:

Attached is the shipping report for & " " & Weekdayname(Weekday(Date())) & " " & Date()

or

Attached is the shipping report for & " " & Format(Date(),"dddd") & " " & Date()
JR

Thank you! I could not get this to work in the macro screen in Access 2010, but it worked with the converted VBA code when removing the extra... & "
 

Users who are viewing this thread

Top Bottom