Reading the AlarmsToRing Table

The AlarmsToRing table contains the date and time for currently active alarms, as well as a path to the item on which each alarm is set. Schedule+ automatically maintains this table as a convenience to the programmer. It is not necessary to update the table when alarms on items are deleted or modified.

Note Do not explicitly add or modify items in the table. This can produce unexpected results.

    To read the AlarmsToRing table
  1. Get the AlarmsToRing table from the global Schedule object.
  2. Set the desired restriction on the table.
  3. Examine all items in the table.
  4. Release the objects.

The following sample code shows how to read the currently active alarms in the AlarmsToRing table:

Public Sub GetNextAlarm()
    Dim objAlarmsToRing As Object
    Dim objAlarm As Object
    
    'Get AlarmsToRing table from the global Schedule object.
    Set objAlarmsToRing = objSchedule.AlarmsToRing
    
    'Set the desired restriction on the table.
    objAlarmsToRing.SetRestriction "Notify", Now, ">="
    objAlarmsToRing.SetRestriction "Notify", DateAdd("d", 1, Now), "<="
    
    'Iterate on all items in the table.
    While Not objAlarmsToRing.IsEndOfTable
        Set objAlarm = objAlarmsToRing.Item
        Debug.Print objAlarm.Notify
        objAlarmsToRing.Skip
    Wend
        
    'Release the objects.
    Set objAlarm = Nothing
    Set objAlarmsToRing = Nothing
End Sub