Redimensioning 二维数组在循环的第二次迭代中给出错误 nº 9 "subscript out of range":- 无法找出原因

Redimensioning bidimensional array gives error nº 9 "subscript out of range" in second iteration of loop: - Can't figure out the reason

这个错误快把我逼疯了。

为了以防万一,我遵循了所有教程,但我无法弄清楚我的代码在我在循环内重新定义数组的行中给出错误 nº9 的原因。 它发生在第二轮循环中。

代码如下:

   Dim ar() As Variant
   Dim cont As Integer
   'Here goes some SQL and querying that works and does not matter for this post. The results are returned well.
  
   cont = 0
   Do Until rs.EOF
    resul = rs!f1 & " " & rs!f2
    'Error thrown in the second round of the loop in the following line:
    ReDim Preserve ar(cont, 1)
    ar(cont, 0) = rs!ID
    ar(cont, 1) = resul
    rs.MoveNext
    cont = cont + 1
Loop

我实在想不通为什么会出现这个错误。 就教程而言,语法还可以。 我想创建这个二维数组,以便我可以将它附加到用户表单中的 combobox.List。

同样,返回的记录集没问题,问题似乎是某个点的数组。

来自 MS documentation for ReDim statement.

If you use the Preserve keyword, you can resize only the last array dimension and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array.

我无法重现您的错误,但相信它与上述内容有关。