After serious thinking Rick Rothstein wrote :
Rather than say "Lower Bound" and "Upper Bound", that should have been "First
Element Upper Bound" and "Second Element Upper Bound". Forget that though...
here is a more complete demonstration.
Sub Test2()
Dim LFirst As Long, UFirst As Long, LSecond As Long, USecond As Long
LFirst = 2
UFirst = 7
LSecond = 4
USecond = 11
ReDim MyArray(LFirst To UFirst, LSecond To USecond)
MsgBox "First Element Lower Bound: " & LBound(MyArray, 1) & vbLf & _
"First Element Upper Bound: " & UBound(MyArray, 1) & vbLf & _
"Second Element Lower Bound: " & LBound(MyArray, 2) & vbLf & _
"Second Element Upper Bound: " & UBound(MyArray, 2) & vbLf
End Sub
Rick Rothstein (MVP - Excel)
Thanks, Rick! So the rule then *still is* that you can't ReDim a
multi-dim array *after it's been dimensioned*, which is not the case in
this OP's context. My bad for not paying attention to the fact that
MyArray() was not dimensioned (thus not declared as a multi-dim array).
Otherwise, the posted code works for me using contrived values.
Perhaps, then, rst.Value("pcamt") is empty, OR is not a valid field.
(Assumes OP is working with a DB recordset)
The OP doesn't claim an error message so I wonder if the code is
covered by an 'On Error Resume Next' statement?
Here's my test...
Private Sub UserForm_Initialize()
Const iCnt As Integer = 3
Dim vListItems() As Variant, i As Integer
ReDim vListItems(iCnt, 1)
For i = 0 To iCnt
vListItems(i, 0) = "Col1: ListItem" & i
vListItems(i, 1) = "Col2: ListItem" & i
Next
With Me.ListBox1
.ColumnCount = 2: .List = vListItems
End With
End Sub
Output to ListBox1:
Col1: ListItem0 Col2: ListItem0
Col1: ListItem1 Col2: ListItem1
Col1: ListItem2 Col2: ListItem2
Col1: ListItem3 Col2: ListItem3