Creating Exceptions to Recurring Appointments

After creating a recurring appointment, you can specify exceptions to the recurrence pattern. For example, you can define an appointment that recurs on Monday of every week, except for those weeks in which Monday is a holiday.

The following procedure shows how to create an exception to recurring appointments by explicitly adding items to the Exceptions table.

    To create an exception to a recurring appointment
  1. Use the New method to create a new item in the Exceptions table.
  2. Set the desired properties on the item.
  3. Release the objects.

The following sample code creates an exception to a recurring appointment:

Public Sub AddException2(objItem As Object)
    Dim objException As Object
    Dim dt As Date
    
    'Note: objItem is a RecurringAppointment object.
    
    'Create an exception that deletes an instance of the recurrence pattern.
    dt = #11/16/95#
    Set objException = objItem.Exceptions.New
    
    'Set the desired properties on the item.
    objException.SetProperties InstanceDate:=LConvertTo32bitDate(dt), Deleted:=True
    
    'Release the object.
    objException = Nothing
    
    'Create an exception that modifies an instance of the recurrence pattern.
    dt = DateAdd("w", 1, dt)
    Set objException = objItem.Exceptions.New
    
    'Set the desired properties on the item.
    objException.SetProperties InstanceDate:=LConvertTo32bitDate(dt), Deleted:=False
    Text:="Exception"
    
    'Release the object.
    objException = Nothing
End Sub
 

You can also create exceptions to recurring appointments by deleting or modifying specific instances in the merged tables.

After you delete an instance of the recurring appointment, Schedule+ automatically removes that instance from the Appointments table and creates a new item in the Exceptions table. To determine which items are exceptions, an application can scan each Exceptions table and examine the properties of each Exception item. For example, the InstanceDate property indicates the date on which the item would have occurred if it had not been deleted.

The series of steps for creating a recurring event or task is similar, but you must delete instances of the recurring event from the Events table and instances of the recurring task from the Tasks table.