ajetrumpet
Banned
- Local time
- Today, 05:12
- Joined
- Jun 22, 2007
- Messages
- 5,638
Array experts,
I have a few assumptions about arrays that I would like some comments on (or clarified) if anyone is interested. Here is what I think the facts are about arrays in general...
1) The only time an array has to be declared a variant is when it is going to hold different values that are of more than one data type.
2) They can hold any number of values that are of a single data type, as long as it is declared in the appropriate section of the procedure (e.g. - Dim MyArray(integer to integer) As String).
3) Array values can be used in functions.
4) The only way to capture values that are completely unrelated to each other, and throw them into an array, is to define them separately. As in the following example (if it is correct)...
I would greatly appreciate any and all comments on this stuff, as it gets into one of the realms of Visual Basic that I am not too good at. I can throw values into a single type array from a recordset loop, and then reference them, but as far as dealing with the "variant" type nature, I am still unsure as to what I am doing.
I have a basic understanding of simplicity when it comes to arrays, but nothing that I would consider "advanced", which is what I am wanting to learn and understand. Thanks all!
I have a few assumptions about arrays that I would like some comments on (or clarified) if anyone is interested. Here is what I think the facts are about arrays in general...
1) The only time an array has to be declared a variant is when it is going to hold different values that are of more than one data type.
2) They can hold any number of values that are of a single data type, as long as it is declared in the appropriate section of the procedure (e.g. - Dim MyArray(integer to integer) As String).
3) Array values can be used in functions.
4) The only way to capture values that are completely unrelated to each other, and throw them into an array, is to define them separately. As in the following example (if it is correct)...
Code:
Dim MyArray(1 to 3) As String, IntCounter As Integer
MyArray(1) = Forms!Form!Control1
MyArray(2) = Forms!Form!Control2
MyArray(3) = Forms!Form!Control3
For intcounter = 1 to 3
MsgBox "'The value of this Array Element is' & ' ' & MyArray(intcounter)"
Next
I have a basic understanding of simplicity when it comes to arrays, but nothing that I would consider "advanced", which is what I am wanting to learn and understand. Thanks all!
Last edited: