sherlocked
Registered User.
- Local time
- Yesterday, 23:03
- Joined
- Sep 22, 2014
- Messages
- 125
Hello experts,
I've been tasked with creating a database to track meetings. I have a table, tblWeeks, that contains each weekday and the date of that weekday for the year 2019. I have a form on which the user enters the start date of the meeting, the day the meeting takes place, how many times it repeats, and whether it is a daily/weekly/bi-weekly/monthly meeting.
The below code works great for a daily meeting, no problem. What I can't figure out is how to move to the next step - if the user wants a bi-weekly Tuesday meeting, how do I search through the table to find the dates and create the records? Using a recordset, there's no "order" to the records and using the rst.Move function doesn't get me the dates I need.
Your assistance as always is appreciated!
I've been tasked with creating a database to track meetings. I have a table, tblWeeks, that contains each weekday and the date of that weekday for the year 2019. I have a form on which the user enters the start date of the meeting, the day the meeting takes place, how many times it repeats, and whether it is a daily/weekly/bi-weekly/monthly meeting.
The below code works great for a daily meeting, no problem. What I can't figure out is how to move to the next step - if the user wants a bi-weekly Tuesday meeting, how do I search through the table to find the dates and create the records? Using a recordset, there's no "order" to the records and using the rst.Move function doesn't get me the dates I need.
Your assistance as always is appreciated!
Code:
Function FindDates()
Dim rsIn As DAO.Recordset
Dim rsOut As DAO.Recordset
Dim Count As Double
Set rsIn = CurrentDb.OpenRecordset("SELECT tblWeeks.DayofWeek, tblWeeks.SchedDate FROM tblWeeks " _
& "WHERE tblWeeks.DayofWeek = '" & Form_frmDataEntry.txtDayofWeek & "' " _
& "AND tblWeeks.SchedDate > #" & Form_frmDataEntry.txtStartDate & "# OR tblWeeks.SchedDate = #" & Form_frmDataEntry.txtStartDate & "#")
Set rsOut = CurrentDb.OpenRecordset("tblMeeting", dbOpenDynaset)
Count = 0
rsIn.MoveFirst
Do Until Count = Form_frmDataEntry.txtRecurrence
rsOut.AddNew
rsOut!MeetingType = Form_frmDataEntry.txtMeetingName
rsOut!MeetingStart = rsIn!SchedDate
rsOut.Update
rsIn.MoveNext
Count = Count + 1
Loop
rsOut.Close
rsIn.Close
Set rsIn = Nothing
Set rsOut = Nothing
MsgBox "Your records have been created!", vbOKOnly
Last edited: