Type | Description | |||
Items as Variant |
An array that control uses to fill with. The array can be one or two-
dimensional. If the array is one-dimensional, the control requires one column
being added before calling the PutItems method. If the Items parameter indicates
a two-dimensional array, the first dimension defines the columns, while the
second defines the number of items to be loaded. For instance, a(2,100) means 2
columns and 100 items.
For instance:
where GetRows() method in ADO retrieves multiple records from a Recordset object and stores them in a two-dimensional array. | |||
Parent as Variant |
Indicates one of the following:
For instance:
where GetRows() method in ADO retrieves multiple records from a Recordset object and stores them in a two-dimensional array. |
The PutItems method loads items from a safe array. The PutItems method may raise one of the following exceptions:
The PutItems method performs:
In essence, by sorting the data appropriately, you establish a clear hierarchy where parent rows are inserted before child rows, maintaining the integrity of the parent-child relationships within the dataset.
For instance, let's say we have the following data:
EmployeeID | EmployeeName | DepartmentID | ParentID |
1 | John | 101 | |
2 | Alice | 102 | 1 |
3 | Bob | 101 | 1 |
4 | Sarah | 102 | 1 |
5 | Emma | 101 | 2 |
6 | Mike | 102 | 2 |
Each row represents an employee.
Having this data organized into a two-dimensional array, the statement PutItems d loads it as a flat table:
whereas PutItems d, ";0;3" loads it as a group structure:
where d is an array as defined next:
Dim d(3, 5) As Variant d(0, 0) = "1": d(1, 0) = "John": d(2, 0) = "101": d(3, 0) = "" d(0, 1) = "2": d(1, 1) = "Alice": d(2, 1) = "102": d(3, 1) = "1" d(0, 2) = "3": d(1, 2) = "Bob": d(2, 2) = "101": d(3, 2) = "1" d(0, 3) = "4": d(1, 3) = "Sarah": d(2, 3) = "102": d(3, 3) = "1" d(0, 4) = "5": d(1, 4) = "Emma": d(2, 4) = "101": d(3, 4) = "2" d(0, 5) = "6": d(1, 5) = "Mike": d(2, 5) = "102": d(3, 5) = "2"
Use the GetItems method to get a safe array with the items in the control. The PutItems method fires AddItem event for each item added to Items collection. Use the Items property to access the items collection. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula.