Quote Originally Posted by Bonnie West View Post
That's probably because you've declared the strItems array as:

Code:
Dim strItems(0 To 1, 0 To 1) As Long
There are two dimensions in the array, but each dimension is limited to only 2 elements (from 0 to 1). Perhaps, you may find it easier if you use a UDT array instead, sort of like this:

Code:
Private Type WindowInfo
    hWnd As Long
    Top As Long
End Type

Private Sub Command1_Click()
    Dim strItems() As WindowInfo
    . . .
    ReDim strItems(0 To 0) As WindowInfo
    . . .
    If . . .
        strItems(p).hWnd = lhndChild
        strItems(p).Top = rec.Top
        p = p + 1
        ReDim Preserve strItems(0 To p) As WindowInfo
    End If
    . . .
End Sub
Bonnie, I haven't used a UDT array before, infact I'm pretty new when it comes to arrays.

What part of my code do I need to strip out, and replace with the UDT array, and what parts of my code do I need to leave in?

What's weird is that the original code works fine if I create an .exe that has two textboxes...but when I try testing it on the real production app it doesn't work for some reason.