javajom
Javajon
- Local time
- Today, 23:50
- Joined
- Mar 5, 2008
- Messages
- 37
Hi I,m having trouble finding information/tutorials about dynamic arrays, the problem is that I'm trying to use a 2 dimensional array and having trouble getting it to work. Before I used 2 arrays, which worked well but now I'm trying to use a 2 dimensional one. It seems that the line of code:
ReDim Preserve data5(UBound(data5) + 1) doesn't work as it's for a single array, so how do I get it to add a element to the expanding array?
ReDim Preserve data5(UBound(data5) + 1) doesn't work as it's for a single array, so how do I get it to add a element to the expanding array?

Code:
Dim data5() As String
Dim data4() As String
Dim data3() As String
Dim data2() As String
Dim data1() As String
Dim mySQL As String
mySQL = " SELECT userName, passWord, securityLevel"
mySQL = mySQL + " from secure111"
mySQL = mySQL + " WHERE(((secure111.securityLevel) >=0))"
myRecordSet.Open mySQL
ReDim data5(0 To i, 0 To 1)
ReDim data4(0 To i, 0 To 1)
ReDim data3(0 To i, 0 To 1)
ReDim data2(0 To i, 0 To 1)
ReDim data1(0 To i, 0 To 1)
While myRecordSet.EOF = False
If myRecordSet.Fields(2).Value = 5 Then
data5(i, 0) = (myRecordSet.Fields(1).Value)
data5(i, 1) = (myRecordSet.Fields(0).Value)
i = i + 1
ReDim Preserve data5(UBound(data5) + 1)
End If