I am attempting to fill a 2D array with items in a recordset, but I keep getting the following error: Microsoft VBScript runtime error '800a0009' Subscript out of range: 'UBound'
I've also tried changing the UBound to Ubound(ProxState,1), but that just gives me the following error on the line following the start of the 'For' loop: Microsoft VBScript runtime error '800a0009' Subscript out of range
Dim ProxCount, LastProx
ProxCount = 0
Do While Not objRS.EOF
ProxCount = ProxCount + 1
objRS.MoveNext
Loop
LastProx = ProxCount - 1
objRS.MoveFirst
Dim ProxState
ProxState = Array(LastProx,1)
For i = 0 To UBound(ProxState,0)
ProxState(i,0) = objRS("ProximityName")
ProxState(i,1) = objRS("InState")
Next
ProxState = Array(LastProx,1)
does not create a two-dimensional (LastProx x 1) array, but an one-dimensional array containing LastProx and 1. – Ekkehard.Horner