Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function basMtgDate(Optional NumDays As Integer = 1, Optional startdate As Variant) As Date
'Michael Red 6/27/2002
'Return the Next Business Day (Date) Available
'The Optional NumDays defaults to 1 (Next Buss. Day), but can be set to any value
'The optional StartDate defaults to the Current (System) DAta, but also may be set by the user
'Requires a table (tblHolidays) with a Date field "HoliDate" as Date
'Sample usage
'? basMtgDate (PC Date = 6/27/02)
'6/28/02 (6/28/02 is a Friday)
'? BasMtgDate(1, #7/3/02#)
'7/5/02 (7/3/02 is a Wednesday, 7/4/02 is a HoliDate, 7/5/02 is a Friday)
'? BasMtgDate(1, #6/29/02#)
'7/1/02 (6/29/02 is a Friday, 7/1/02 is Monday)
'? BasMtgDate(7)
'7/9/02 (PC Date is Thursday, 6/27/02.
' 6/29, 6/30, 7/6 & 7/7 are Weekends
' 7/4 is a holiday.
Dim dbs As DAO.Database
Dim rstHolidays As DAO.Recordset
Dim MyDate As Date
Dim MyDays As Long
Dim strCriteria As String
Dim NumSgn As String * 1
Set dbs = CurrentDb
Set rstHolidays = dbs.OpenRecordset("tblHolidays", dbOpenDynaset)
NumSgn = Chr(35)
If (IsMissing(startdate)) Then
startdate = Date
End If
MyDate = Format(startdate + 1, "Short Date")
Do While MyDays < NumDays
Select Case (Weekday(MyDate))
Case Is = vbSunday 'Sunday
'Do Nothing, it is NOT a Workday
Case Is = vbSaturday 'Saturday
'Do Nothing, it is NOT a Workday
Case Else 'Normal Workday
strCriteria = "[HoliDate] = " & NumSgn & MyDate & NumSgn
rstHolidays.FindFirst strCriteria
If (rstHolidays.NoMatch) Then
MyDays = MyDays + 1
Else
'Do Nothing, it is NOT a Workday
End If
End Select
If (MyDays >= NumDays) Then
Exit Do
End If
MyDate = DateAdd("d", 1, MyDate)
Loop
basMtgDate = MyDate
End Function