2
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by jireh
0

I don't know if this is right but just try it

Function LookForForm()
    Dim frm As Form
    
    For Each frm In Forms
        If frm.Name <> mdiMain.Name Then
            ...put your code here
        End If
    Next
End Function
0

I've tried it and it works. I put it in the timer_timer sub which I have in the form that I want last unloaded, so it might take up to a minute till the program ends. Is there a better place to put it

0

I've put it in all the other forms unload event.
Thanks for your help

0

put it in the module so that you can call the sub when you needed. I used that everytime I open a MdiChild form so that i dont need to unload the forms that are already opened.

Private Sub SectionCmd_Click()
   LookForForm
   SectionForm.Show
End Sub

Private Sub DepartmentCmd_Click()
   LookForForm
   DepartmentForm.Show
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.