Creating Exceptions to Recurring Events

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

    To create an exception to a recurring event
  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 event:

Public Sub AddException2(objItem As Object)
    Dim objException As Object
    Dim dt As Date
    
    'Note: objItem is a RecurringEvent 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 events by deleting or modifying specific instances in the merged tables.

After you delete an instance of the recurring event, Schedule+ automatically removes that instance from the Events table and creates a new item in the Exceptions table. To determine which items are exceptions, an application can scan the 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 appointment or task is similar, but you must delete instances of the recurring appointment from the Appointments table and instances of the recurring task from the Tasks table.