Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a command to check for an open form?

Status
Not open for further replies.

meagain

MIS
Nov 27, 2001
112
CA
Hi All,

Late in the day, I need to stop a process that operates on a 3 minute timer which is executed from a form (F-KO5-T). If the form is open then it is okay for the process to be discontinued, however if the form is not open, then it is important that the process which is in progress continues until the form is reopened. Is there a command to see if a form is open? Can I put some code into a module to check if a form is open and if it is then close the form and start a different process otherwise pause for 1 minute then recheck for the form?

Your help is greatly appreciated.
 
As a starter for ten this function will tell you whether or not a form is open:

Code:
Public Function IsFormOpen(ByVal strFormName As String) As Boolean
    Dim MyForm As Access.Form
    Dim retval As Boolean: retval = False
    
    For Each MyForm In Application.Forms
        If MyForm.Name = strFormName Then
            retval = True
            Exit For
        End If
    Next MyForm
    
    IsFormOpen = retval
End Function

Ed Metcalfe.

Please do not feed the trolls.....
 
Why not simply test the following boolean value ?
CurrentProject.AllForms("F-KO5-T").IsLoaded

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Cos I didn't know that property even existed. :)

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top