How to check if a form is loaded?

Posted on 2004-08-24
Last Modified: 2012-05-05
My user has requested to be able to get anywhere from anywhere in the application.  I have buttons on the forms that provide this ablity.  How can I check if a form is loaded?  If a form is already loaded I don't want to re-load it.
Question by:mlcktmguy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Expert Comment

ID: 11882168
You can just use the .Show method - this will load the form if it is not already loaded.


Accepted Solution

nichia earned 50 total points
ID: 11882199
Calling for example Load Form2 will not cause the form to reload if it has already been loaded.  The Form_Load sub is called only when the form is either called the first time, or first unloaded, then called again.

If you still need to determine what forms are in memory, you can iterate the Forms collection:

Dim frm As Form
For Each frm In Forms
    If frm.Name = "Form2" Then
        Debug.Print "Form2 is Loaded"
    End If

Hope it helps!
LVL 26

Expert Comment

ID: 11882707

Public Function IsLoaded(ByVal FormName As String) As Boolean
    Dim i As Integer

    On Error Resume Next
    IsLoaded = False
    For i = 0 To Forms.Count - 1
        If Forms(i).Name = FormName Then
            IsLoaded = True
            Exit Function
        End If
End Function

Dim FrmD As form1
If (IsLoaded("form1") = False) Then
        Set FrmD = New form1
    End If

Author Comment

ID: 11882972
Thank you nichia and EDDYKT both of your solutions look like they work.  I was implementing the solution provide by nichia when EDDYKT responded.  The nichia solution does work and it was provided first so I am awarding the points to nichia.

Expert Comment

ID: 25915840
Is there a method to check if a form is loaded in

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question