Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Checking if a form is active/open (97)

    How can I check if a form is open/ active? I want to do a check within a piece of code to see if a particular form is open before it continues.
    Jerry

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Checking if a form is active/open (97)

    See the thread starting at <post#=265158>post 265158</post#>.

    Note: Charlotte's tip in the last post in the thread applies to Access 2000 and higher only.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Checking if a form is active/open (97)

    Hi Hans

    Thanks for that. With your help I discovered that there is in fact a sample function in Northwind. If anybody is interested the code is as follows:

    Function IsLoaded(ByVal strFormName As String) As Boolean
    ' Returns True if the specified form is open in Form view or Datasheet view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    If Forms(strFormName).CurrentView <> conDesignView Then
    IsLoaded = True
    End If
    End If

    End Function

    It works like a dream
    Jerry

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Checking if a form is active/open (97)

    Yes, the function I posted in <post#=265290>post 265290</post#> is in fact a shortened version of the utility function from the Northwind database.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Checking if a form is active/open (97)

    And there was me thinking you had 'free-coded it' <img src=/S/angel.gif border=0 alt=angel width=15 height=21>
    Jerry

Posting Permissions

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