我在Win7下使用Access 2010。我发现我可以在运行时通过简单地调用ReDim arrayName(x)
而不首先将数组声明为Dim arrayName()
.
Sub FooBar()
ReDim myArray(2)
myArray(0) = "This is the first string in myArray."
myArray(1) = "This is the second string in myArray."
myArray(2) = "And this is the last string in myArray."
MsgBox myArray(0) & vbCrLf & myArray(1) & vbCrLf & myArray(2)
End Sub
有什么理由我不应该使用这个快捷方式吗?
干杯!