I've designed a Macro to rename my report to include yesterday's date and then e-mail it. When I click this Macro from the Access Objects list, it runs perfectly.
However, I would like the Macro to run On Click of a button. I have created a form with various buttons for opening various reports. There is also this button to Email Yesterday's Production Report. When clicked it renames the form to what I have defined as the new name for my Report and emails the report without renaming.
Here is the Macro:
OpenReport
Report Name: rep Yesterday's Production Report
View: Design
Filter name:
Where Condition:
Window Mode: Normal
SelectObject
Object Type: Report
Object Name: rep Yesterday's Production Report
In Database Window: No
SetProperty
Control Name:
Property: Caption
Value: = "Production" & Date()-1
EmailDatabaseObject
Object Type: Report
Object Name: rep Yesterday's Production Report
Output Format: PDF Format (*.pdf)
To: you@gmail.com
Cc:
Bcc: me@gmail.com
Subject: Daily Production
Message Text: Hello all - Attached is yesterday's production. Thanks.
Edit Message: Yes
Template File:
Any ideas on how I can get this Macro to run On Click of a button? I added the SelectObject line because I thought that would help to make sure the Macro wasn't renaming the Form, but this still doesn't work... I even tried creating a new form with just this one button on it to run this Macro and ... no luck!
Thank you!
Colette