Hi All,
Maybe someone can assist me in trying to get this code to work? I have half of it working but not the month end part.
What I need:
When launching the database or if it is already loaded and you show all records and it is a Friday then show the message in a popup box saying "Please Run Your Weekly Report at EOD!" which works.
However, if it is the last Friday at the end of the month then I want another message box to appear saying "Please Run Your Monthly Reports at EOD!", this part doesn't work.
Please see the code I have below and maybe someone can assist me in getting it correct.
The Function/Module1:
The code behind the On-Timer event
with interval of 0
Can someone please help?
Thanks in advance.
Maybe someone can assist me in trying to get this code to work? I have half of it working but not the month end part.
What I need:
When launching the database or if it is already loaded and you show all records and it is a Friday then show the message in a popup box saying "Please Run Your Weekly Report at EOD!" which works.
However, if it is the last Friday at the end of the month then I want another message box to appear saying "Please Run Your Monthly Reports at EOD!", this part doesn't work.
The Function/Module1:
Code:
Function eom(ByVal Input_Date As Date) As Date
eom = DateAdd("d", -1, DateAdd("m", 1, DateSerial(Year(Input_Date), Month(Input_Date), 1)))
End Function
The code behind the On-Timer event
with interval of 0
Code:
Private Sub Form_Timer()
Dim p_dtDate As Date
MonthEnd = eom(Now())
'Weekday 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday
If Weekday(Now()) = 6 Then
MsgBox ("Please Run Your Weekly Report at EOD!")
If Weekday(Now()) = MonthEnd Then
MsgBox ("Please Run Your Monthly Reports at EOD!")
End If
End If
End Sub
Can someone please help?
Thanks in advance.