As you found, recurring events are not the simplest thing on the planet.
The simplest approach is to create a table with fields like this:
EventID primary key
StartDate Date/Time date of the first appointment. Requiried.
PeriodType Text "d", "m", "q", or "yyyy". Required.
Freq Number how many periods between events. >= 0.
EventCount Number how many events in the series.
Next, you need a counting table from 1 to the highest number of repeating
appointments you could need (perhaps 1000?) This table has one field named
(say) CountID, type Number, primary key, and you save the table as (say)
tblCount. Enter record from *zero* to the highest number. The code in this
link can populate the table for you:
http://allenbrowne.com/ser-39.html
Now create a query using both tables, but with *no* join between them in the
upper pane of table design. This gives you every possible combination (a
Cartesian product), which we will use to get a record for each appointment
in the series.
In the Criteria row of the query under CountID, enter:
< [EventCount]
This limits the query to the right number of events for the series.
Now enter an expression like this in the Field row of the query:
EventDate: DateAdd([PeriodType], [CountID] * [Freq], [StartDate])
This gives you the date of each event in the series.
This approach is fully normalized and quite easy to implement. The major
limitation is that you cannot remove or reschedule one appointment in the
series. If you need that functionality, you may be able to do that with a
table of exceptions that uses an EventID and CountID and EventDate, so you
can switch the n-th appointment for a particular event to a different date
(or to Null for no date), and then outer join the above query with the
exception table to get the alternative date.
If that's not powerful enough, you can actually generate a record in a
related table for each event in the series. This gives great flexibility but
has several drawbacks:
- Doesn't cope with unlimited series (no end date)
- Harder to maintain. For example, if a change is made to the series, how to
you cascade that change to all events in the series, when some appointments
may be specific (out of the normal series)?
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
amy said:
I am trying to create an access database that will show upcoming
appointments
with clients. These appointments are always recurring every month, 3
months,
or 6 months. I would like to enter the appointment and client information
into a table one time and then see the appointments when I open a weekly
or
monthly report. Also, I want to mark the appointment complete in my table
after it is held so that a meeting that is scheduled but not held will
automatically show on the next week's calendar.
I have created several other somewhat complex databases in Access for my
company, but I am having trouble with this one. Any help that you can
offer
on any of these points would be GREATLY appreciated!!!!!
Thanks