S
Secret Squirrel
I'm using the following code to create new records for each day including the
starting date and ending date based on two controls on my form, txtVacStart &
txtVacEnd.
It creates new records and enters each of the dates into the field
"RegularDate". How can I have it automatically skip over weekends and
holidays?
Dim dtVacDay As Date
Dim rs As DAO.Recordset
Set rs = DBEngine(0)(0).OpenRecordset("tblVacationTime", dbOpenTable,
dbAppendOnly)
For dtVacDay = Me.txtVacStart To Me.txtVacEnd
rs.AddNew
rs.Fields("EmployeeName") = Me.EmployeeName
rs.Fields("RegularDate") = dtVacDay
rs.Update
Next dtVacDay
rs.Close
Set rs = Nothing
starting date and ending date based on two controls on my form, txtVacStart &
txtVacEnd.
It creates new records and enters each of the dates into the field
"RegularDate". How can I have it automatically skip over weekends and
holidays?
Dim dtVacDay As Date
Dim rs As DAO.Recordset
Set rs = DBEngine(0)(0).OpenRecordset("tblVacationTime", dbOpenTable,
dbAppendOnly)
For dtVacDay = Me.txtVacStart To Me.txtVacEnd
rs.AddNew
rs.Fields("EmployeeName") = Me.EmployeeName
rs.Fields("RegularDate") = dtVacDay
rs.Update
Next dtVacDay
rs.Close
Set rs = Nothing