Alex & Access

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

About Me Search
My Photo
Name:Alex Dybenko

Location:Moscow, Russia
Google
 
Web AccessBlog.net

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

Links to this post:

Create a Link

<< Home