Hahah...The hamster is back!!!
VB Code:
'In a module
Option Explicit
Private mcolForms As New Collection
Public Function AddForm(ByRef MyForm As Form) As Boolean
On Error Resume Next
mcolForms.Add MyForm, MyForm.hWnd & "K"
If Err.Number = 0 Then
AddForm = True
End If
End Function
Public Sub RemoveForm(ByRef MyForm As Form)
On Error Resume Next
mcolForms.Remove MyForm.hWnd & "K"
End Sub
'In the MDI form when you want to open another instance of frmOpen
Private Sub OpenNewForm
Dim frmNew As frmOpen
Set frmNew = New frmOpen
Load frmNew
If AddForm(frmNew) Then
frmNew.Show
Else
Unload frmNew
Set frmNew = Nothing
End If
End Sub
'In every childform
Private Form_Unload()
RemoveForm Me
End Sub
That's how to keep track of what forms your MDI form has opened...You can add further functiuons to the module to add greater functionality to the collection, ie Count...
Hope this helps...