How to Use Splits > Creating and Removing Splits |
At design time, you can create and remove splits using the list's visual editing menu. Please refer to Visual Editing Mode for details.
At run time, you can create and remove splits using the Splits collection's Add and Remove methods. Each method takes a zero-based split index:
Example Title |
Copy Code
|
---|---|
Dim S As TrueDBList80.Split Set S = TDBList1.Splits.Add(0) ' Create a split with index 0 TDBList1.Splits.Remove 1 ' Remove the split with index 1 |
The new Splits(0) object is "cloned" from the old Splits(0) object. Both splits will have the same property values after the Add method executes. The old Splits(0) becomes Splits(1), the old Splits(1) becomes Splits(2), and so on.
You can determine the number of splits in a list using the Splits collection's Count property:
Example Title |
Copy Code
|
---|---|
' Set variable equal to the number of splits in TDBList1
variable = TDBList1.Splits.Count
|
You can iterate through all splits using the Count property, for example:
Example Title |
Copy Code
|
---|---|
For n = 0 To TDBList1.Splits.Count - 1 Debug.Print TDBList1.Splits(n).Caption Next n |
Of course, a more efficient way to code this would be to use a For Each...Next loop:
Example Title |
Copy Code
|
---|---|
Dim S As TrueDBList80.Split For Each S In TDBList1.Splits Debug.Print S.Caption Next |
The Count property is primarily used to append a new split to the end of the Splits collection, as follows:
Example Title |
Copy Code
|
---|---|
Dim S As TrueDBList80.Split Set S = TDBList1.Splits.Add(TDBList1.Splits.Count) |
The new Split object will inherit all of its properties from the last object in the collection.