Question : Code Last business day of the month

Hello Everyone:
I have the following code on the OnLoad event of a MS Access Form that will fire on the last day of the month reminding a user to complete their end of month tasks. Is there a way to modify this code so it will fire on the LAST business day of the month. For example this code will fire on Jan 31st which is a Sunday, is it possible to modify this code so that it would have fired on Jan 29th ?

Thanks
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
Private Sub Form_Load()
cboNameEnter.Value = [Forms]![frmLogon]!cboEmployee
If DateSerial(Year(Date), Month(Date) + 1, 0) = Date Then
           MsgBox ("Today is the last day of month dont forget to do complete your End of Month Tasks")
Else

End If
End Sub

Answer : Code Last business day of the month

try this, see if you see the message box "last day is sunday"


If DatePart("w", DateSerial(Year(Date), Month(Date) + 1, 0)) = 1 Then

    msgbox "Last day is Sunday"


    'find the Friday before the end of the month
    If DateSerial(Year(Date), Month(Date) + 1, 0) - 2 = Date Then
           MsgBox ("Today is the last day of month dont forget to do complete your End of Month Tasks")
    End If
    Else
    If DateSerial(Year(Date), Month(Date) + 1, 0) = Date Then
           MsgBox ("Today is the last day of month dont forget to do complete your End of Month Tasks")
    End If

End If
Random Solutions  
 
programming4us programming4us