G
Guest
I have created a report in MS Access 2003 that is run daily, it prompts the
user for the date by using a date parameter. The user enters the previous
days date and displays the records for that date. If there are no records for
the report for the specified date a dialog box is displayed stating "There
are no records to view". In addition to the dialog box an email is sent to
several people informing them that there were no records for yesterday
(Yesterday: dtmYesterday = (Now) -1).
On Monday I run the report for Sunday, Saturday and Friday: because the
report was ran on Monday I either have to change the system date so the
correct date appears in the email generated.
What I am wanting to do is pass the date parameter to the Sub so I can use
the date of the report instead of Yesterday's date, because if I do not
always run the report everyday.
Any suggestions?
The Code to send the email is:
===============================================
Sub Email()
Set objEmail = CreateObject("CDO.Message")
dtmYesterday = (Now) - 1
'MsgBox dtmYesterday
objEmail.From = "(e-mail address removed)"
objEmail.To = "(e-mail address removed); (e-mail address removed)"
objEmail.Subject = "Daily Reports"
objEmail.Textbody = "You will not be able to view the report for " &
dtmYesterday & vbCrLf & vbCrLf & ". Because there was no pertinent activity "
& dtmYesterday
objEmail.Send
End Sub
=================================================
Thank you
user for the date by using a date parameter. The user enters the previous
days date and displays the records for that date. If there are no records for
the report for the specified date a dialog box is displayed stating "There
are no records to view". In addition to the dialog box an email is sent to
several people informing them that there were no records for yesterday
(Yesterday: dtmYesterday = (Now) -1).
On Monday I run the report for Sunday, Saturday and Friday: because the
report was ran on Monday I either have to change the system date so the
correct date appears in the email generated.
What I am wanting to do is pass the date parameter to the Sub so I can use
the date of the report instead of Yesterday's date, because if I do not
always run the report everyday.
Any suggestions?
The Code to send the email is:
===============================================
Sub Email()
Set objEmail = CreateObject("CDO.Message")
dtmYesterday = (Now) - 1
'MsgBox dtmYesterday
objEmail.From = "(e-mail address removed)"
objEmail.To = "(e-mail address removed); (e-mail address removed)"
objEmail.Subject = "Daily Reports"
objEmail.Textbody = "You will not be able to view the report for " &
dtmYesterday & vbCrLf & vbCrLf & ". Because there was no pertinent activity "
& dtmYesterday
objEmail.Send
End Sub
=================================================
Thank you