Results 1 to 5 of 5

Thread: Test for Forme

  1. #1
    JamesP
    Guest

    Test for Forme

    Is it possible to test for whether a particular form is open or not?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Test for Forme

    This will work in Access 97 or 2000. Pass it the formname and it will return a true if the form is loaded.

    Public Function IsLoaded(strObjNm As String) As Boolean
    Dim intOpen As Integer
    Dim blnOpen As Boolean

    intOpen = SysCmd(acSysCmdGetObjectState, acForm, strObjNm)
    Select Case intOpen
    Case acObjStateOpen, acObjStateDirty, acObjStateOpen + acObjStateDirty
    blnOpen = True
    Case Else
    blnOpen = False
    End Select
    IsLoaded = blnOpen
    End Function
    Charlotte

  3. #3
    JamesP
    Guest

    Re: Test for Forme

    Thank you charlotte!

  4. #4
    New Lounger
    Join Date
    Dec 2000
    Location
    Rockhampton, Queensland, Australia
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Test for Forme

    I got the following from somewhere, possibly an old lounge post.

    Public Function FormIsOpen(FormName As String)
    'Check if form is open
    'True if open

    FormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, FormName) And acObjStateOpen) <> False
    End Function

    Neville

  5. #5
    JamesP
    Guest

    Re: Test for Forme

    Excellent!!
    Thanks Neville!

Posting Permissions

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