Modifying or creating new items in TrackRecord via ActiveX Automation


This article explains how to modify an existing item or create a new item by automation.


I have written an application to get an item through iteration or as the results of a query, but when I try to set the value of a field equal to something, it is always read only. How can I modify an existing item or create a new item by automation?


In order to take into account the Object Oriented nature of the database, as well as permission issues, direct manipulation of the data contained in TrackRecord is not possible. To create a new item or change an existing one you will want to use the ProcessItemChanges (PIC) method of the automation. Here is an excerpt from the documentation on ProcessItemChanges.

ProcessItemChanges Function

ProcessItemChanges(ScriptFile As Filename, [UserID As Long]) As Items

Process item change script. Item change scripts can be used to make changes to existing items, and to create new items. Returns items that were changed.

The format for the script is as follows:

The first line must always be either [< identifier >] or [< type name >] where < identifier > is an identifier string for an existing item, or < type name > is the name of the item type that should be used for creating a new item.

Each of the following lines is of the form:

< field-name > \t < field-value >

where < field-name > is the name of the field, and < field-value > is the value to set for the field. The \t represents a hard tab character in the file (ASCII 9), which can be entered with most text editors. Certain types of fields have additional modifiers other than the name of the field:


For a field called Name, the options are Name.First, Name.Last, and Name.Middle.


For a fields called Address, the options are Address.Address1, Address.Address2, Address.City, Address.State, Address.Country, and Address.Zip.


For a field called Timespan, the options are Timespan.Start Time and Timespan.End Time, which contain the combined date and time separated by a null character, and StartDate, StartTime, EndDate, and EndTime for date or time individually.

Date/Time Options

For a field called Date/Time, the options are Date/Time.Date and Date/Time.Time.


For checkboxes and radio-buttons, the < field-value > should start with a space if the checkbox/radio button should be unchecked, and an "X" if it should be checked.


For a field called Reported By, the options are Reported By.Add and Reported By.Delete. For either one, the < field-value > should be the identifier of the item to add or delete.

Compound type lists

For compound type fields, the <field-value> is the identifier of the item to select. After all the fields are listed, the item is ended with a line:


Normally, items with an empty default abbreviation are not saved by ProcessItemChanges. However, if you want to force all items to be saved, whether they are complete or not, use the following line to end the item:

[enditem save]

To ensure that items are unique, end the item with:

[enditem unique]

Duplicates are determined by comparison of the Dupe field. The new or matching item will be returned.

Each item can be followed by the end of the file, or by another item. A sample script might be:

Name.Last Strange
Name.First Mickey
Company a000000
Note: Notepad field data requires double quotes. Any quote character (') within a string field requires a preceding backslash (\) character.
Old KB# 14678
Comment List