Hey guys,
I have a if then else statement that's giving me trouble. I need to display an icon on a website if a certain date(testdate) is:
-today
-yesterday
-tomorrow(if and only if it's now 5pm or later)
-if today is friday, saturday, sunday and the testdate is friday, saturday, sunday, or monday
Take a look below and see if you can figure out a better way to do this:
Code:
today = DateSerial(Year(Now), Month(Now), Day(Now))
todayhour = hour()
yesterday = DateAdd("d", -1, today)
tomorrow = DateAdd("d", 1, today)
testdate = completedate
testdate = DateSerial(Year(testdate), Month(testdate),Day(testdate))
'1 displays the icon
'0 doesn't display the icon
If testdate = today OR testdate = yesterday OR (testdate = tomorrow AND todayhour >= 17) Then
DisplayCaseSummaryIcon = 1
Else
If WeekDay(today) <> 6 And Weekday(today) <> 7 And Weekday(today) <> 1 Then
DisplayCaseSummaryIcon = 0
Else
If testdate = 6 Or testdate = 7 Or testdate = 1 Or testdate = 2 Then
DisplayCaseSummaryIcon = 1
End If
End If
Thanks