English

How To: Update a recordset with events from the TrackingLayer

Summary

Events on the MapObjects TrackingLayer are temporary. The following Visual Basic code sample demonstrates how to store the events permanently in a shapefile or an existing ArcSDE layer.

Procedure

  1. Declare the following variables:

    Code:
    Dim tl As MapObjects2.TrackingLayer
    Dim recs As MapObjects2.Recordset

  2. Return the recordset that you want to edit:

    Code:
    Set recs = Map1.Layers(0).Records

  3. Loop through the events that currently reside on the Tracking Layer and update the recordset:

    Code:
    Dim i As Integer
    For i = 0 To tl.EventCount - 1
    recs.AddNew
    Set recs.Fields("Shape").Value = tl.Event(i).Shape
    recs.Update
    Next
    recs.StopEditing


    Note:
    Change the library name from MapObjects2 to MapObjects to use the code in a MapObjects 1.x project. MapObjects 1.x supports only point shapes as events.