News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Name:Alex Dybenko

Location:Moscow, Russia

Wednesday, May 18, 2005

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)
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.


Post a Comment

<< Home