Is array dimentioned?
Interesting trick was mentioned in VB Classic list - how to check if dynamic array already dimensioned? Answer is Not operator. Before i used a universal method - On Error Resume Next. Here a sample procedure:
Sub TestArray()
Dim A() As Long
'ReDim A(1 To 4)
If (Not A) = -1 Then
'not dimensioned
Debug.Print (Not A)
Else
'dimensioned
Debug.Print UBound(A)
End If
End Sub
This works in VB6 and Access 2003. But does not work in Access 97.
Few treads can be also found in Google Groups, for example this one.
Sub TestArray()
Dim A() As Long
'ReDim A(1 To 4)
If (Not A) = -1 Then
'not dimensioned
Debug.Print (Not A)
Else
'dimensioned
Debug.Print UBound(A)
End If
End Sub
This works in VB6 and Access 2003. But does not work in Access 97.
Few treads can be also found in Google Groups, for example this one.
0 Comments:
Post a Comment
<< Home