Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002

    Question Unanswered: Is a particular form open?

    I know this is probably a question with a very simple answer, probably to do with the forms! collection, and I could swear that I've seen the property before, but is there a way to ask if a particular form is open in VBA code? IE--if form is open then do some stuff. Thank you in advance for your time and responses.

  2. #2
    Join Date
    Sep 2004
    Reston, VA
    You sure can. You just need to use the AllForms collection of your project. Put a function like this in a module somewhere:

    Public Function IsFormOpen(strFormName as String) as Boolean
       IsFormOpen = CurrentProject.AllForms(strFormName).IsLoaded
    End Function
    If the return value of the function is true, the form is open. Call it like this:

    If IsFormOpen("formname") Then
       do something here
       do something else
    End If

  3. #3
    Join Date
    Nov 2002

    Talking Thanks

    Thanks a lot! That was very helpfull. I knew that it was something easy like that but it was driving me crazy finding it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts