Recurring events (1 Viewer)

stevekos07

Registered User.
Local time
Today, 03:02
Joined
Jul 26, 2015
Messages
174
I have a volunteer roster which records volunteers and their rostered days in a table. What I would like to include is an ability to add a field which allows for recurring events such as every week, every month etc.

I know that this kind of thing can get very complicated with options such as "every second Thursday of the month" or "Monday every week and Friday every fortnight" being a challenge.

But for now, even if we could place a check box on a form to indicate a regular day of the week that would be helpful. We already have yes/no fields for every day of the week indicating the volunteer's availability on certain days. Having another checkbox indicating "Weekly" would be helpful.
Any ideas?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:02
Joined
Feb 28, 2001
Messages
27,245
When you start down the "once every xxxx" road, your problem is whether that period adjusts - or does not adjust - for weekends and holidays.

Let's not even START with the issue about "every second Thursday of the month" - particularly since that choice of phrase is ambiguous. You have to remember that "every second Thursday" could mean "Thursdays two weeks apart" or "the Thursday that occurs one week later than the first Thursday of the month." If your design includes ambiguity, I assure you someone will be confused by it.

OK, let's talk about how one might approach this. You need to design your event table to include events with date, time, description, etc. etc. and a prime key such as an autonumber that is present solely for uniqueness. Whether this table is every flushed will be up to you and will in all probability depend on your historical record-keeping needs.

If you want to put recurrences in this table, you could take a lesson from Outlook or from Windows Task Scheduler. Your event's timing specs might therefore include a "not before" date and a "not after" date so that you could schedule a finite rather than an indefinite sequence. For singular events, these two dates might just match and be the "due" date for the event.

You might also want a recurrence code and value. Look at the things you can get from DatePart as an example. You can use codes like "d" for day of the month, "w" for day of the week, and whatever options tickle your fancy.

Then write a function where you feed in a record number from this table that contains your events and a simple Date parameter. The function can look at the record and look at the date, using DatePart if needed, to determine if the event described by the record number matches the input date. Then return True or False. This function in VBA is where you will spend some time taking care of various frequencies of scheduling.

This would let you arbitrarily test a date other than today's date, and you might use this when forming a report that lists the week's activities or when filling in text boxes representing your calendar. Then, an item is on your calendar when the date input for comparison purposes matches the date in a record in your table. Doesn't matter whether the event is singular or recurring. If the dates of the input and the event entry match, then the event is due on that date.

This isn't a trivial problem. You should note that you might be better off if you could make the Outlook calendar help you with some of this. At least in theory it is possible for Access to read an Outlook calendar, though I've not done such a thing. Messages and tasks, I've handled. Calendar entries, not so much.
 

Users who are viewing this thread

Top Bottom