santastefano
Programmer
I have a loop which creates a timetable based on user input of the first date and the frequency.
I need to refer varStartDate to a list of user maintained holidays before looping back to avoid bookings during holidays. I have tried
and receive an error message for the .Find instruction
I have tried opening a query based on the holiday table and user input and checking for an empty record set - empty meaning OK, some content meaning add 7 days.
I have tried adapting various date solutions posted here without success.
Can anybody please be a sheepdog and round me up and point me in the right direction?
If you got to here, thanks for reading.
George
Code:
Do While varSessionsTotal > 0
With rsTimeTable
.AddNew 'Creates new record in the table
!Code = varCode
!StartDate = varStartDate
!From = varTime1
!To = varTime2
.Update 'Confirms the record to the table.
End With
varSessionsTotal = varSessionsTotal - 1
varStsrtDate = varStartDate + 7
Loop
Code:
Dim strCriteria As Date
Dim rsHolidays As DAO.Recordset
Set DB = CurrentDb
Set rsHolidays = DB.OpenRecordset("tblHolidays", dbopendynaset)
strCriteria = varStartDate
With rsHolidays
.FindFirst strCriteria
End With
I have tried opening a query based on the holiday table and user input and checking for an empty record set - empty meaning OK, some content meaning add 7 days.
I have tried adapting various date solutions posted here without success.
Can anybody please be a sheepdog and round me up and point me in the right direction?
If you got to here, thanks for reading.
George