Array Data Types
To declare an array variable in Basic syntax, use a set of parentheses in the variable declaration.
To reference an element of the array, use parentheses with the index number.
The ReDim statement changes the number of elements in the array and resets their values. If you want to keep the existing values intact, then also use the Preserve keyword.
Assigning values to an array is done in different ways. If you know what the values of an array are during the development process, you can initialize the array with these values using the Array() function. Pass the Array() function all the elements as a comma delimited list and it returns an array that is fully populated with these elements. When using the Array() function you don’t have to specify the array size. Crystal Reports figures that out for you.
As expected, if you want to simply assign a value to an individual element in the array, then the index must be within the array’s bounds. But if you are assigning an entire array to another array variable and they are different sizes, you do not have to redimension the target array. The target array gets overwritten and it will have the size of the existing array.
Range Data Types
To declare a variable as a Range data type, declare it as one of the standard data types and put the Range keyword at the end of the declaration. The data types that are allowed to have a related Range data type are Number, Currency, String, DateTime, Date, and Time.