Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    LA, CA
    Posts
    18

    Unhappy Unanswered: checking if a form is open (from VBA)

    I just wanted to know if someone knows how to check if a form is open from a function. I have a function that needs to do this and I can't get it working!!! And help would be much appreciated....

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: checking if a form is open (from VBA)

    Function IsLoaded(ByVal strFormName As String) As Integer

    ' 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
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: checking if a form is open (from VBA)

    Originally posted by matatan
    I just wanted to know if someone knows how to check if a form is open from a function. I have a function that needs to do this and I can't get it working!!! And help would be much appreciated....
    Function IsLoad(strFormName As String) As Boolean

    Const conDiseg = 0
    Dim entX As Integer

    IsLoad = False

    For entX = 0 To Forms.Count - 1
    If Forms(entX).FormName = strFormName Then
    If Forms(entX).CurrentView <> conDiseg Then
    IsLoad = True
    Exit Function
    End If
    End If
    Next

    End Function

    This function can help you, return True if the name form il load an False if is not load.
    Saludos
    Norberto

  4. #4
    Join Date
    Jan 2004
    Location
    LA, CA
    Posts
    18

    Thumbs up

    Perfect! That worked out great. Thanks guys...

Posting Permissions

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