G
Guest
I am having trouble working with a dynamic, multidimensional array.
' The variable cvDirtyControls() is a dynamic array, which has just been
declared and is empty.
cvelement = 0
ReDim Preserve cvDirtyControls(cvelement, 3) ' make multidimensional
cvDirtyControls(cvelement, 0) = cvcontrol
cvDirtyControls(cvelement, 1) = cvTablename
cvDirtyControls(cvelement, 2) = cvFieldname
cvDirtyControls(cvelement, 3) = cvvalue
' this results in the array having the specified values.
' Then I change the values of the four variables (cvcontrol, cvTablename,
' cvFieldname and cvvalue) and want to add another
' element to the array with the new values.
' I increment the value of cvelement:
cvelement = cvelement + 1
' But when I try to add another element to the array:
ReDim Preserve cvDirtyControls(cvelement, 3) ' add the new element to the
first dimension
' I get a subscript out of range error.
' How can I work with a dynamic, multidimensional array?
' The variable cvDirtyControls() is a dynamic array, which has just been
declared and is empty.
cvelement = 0
ReDim Preserve cvDirtyControls(cvelement, 3) ' make multidimensional
cvDirtyControls(cvelement, 0) = cvcontrol
cvDirtyControls(cvelement, 1) = cvTablename
cvDirtyControls(cvelement, 2) = cvFieldname
cvDirtyControls(cvelement, 3) = cvvalue
' this results in the array having the specified values.
' Then I change the values of the four variables (cvcontrol, cvTablename,
' cvFieldname and cvvalue) and want to add another
' element to the array with the new values.
' I increment the value of cvelement:
cvelement = cvelement + 1
' But when I try to add another element to the array:
ReDim Preserve cvDirtyControls(cvelement, 3) ' add the new element to the
first dimension
' I get a subscript out of range error.
' How can I work with a dynamic, multidimensional array?