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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if Form is Open

Status
Not open for further replies.

DeoM

Programmer
Jul 3, 2004
49
PH
Hi,
This is easy for you guys. I know I've seen the VB code for this; but when you need it you cannot find it.
Please give me code to check whether a form is open or not.
Thanks,
Jun M
 
If CurrentProject.AllForms("frmProjectsSearch").IsLoaded Then
DoCmd.SelectObject acForm, "frmProjectsSearch": Forms!frmProjectsSearch.Visible = False
End If
 
Hundereds of posts here. one below.
Code:
Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
        If Forms(strFormName).CurrentView <> 0 Then
            fIsLoaded = True
        End If
    End If
End Function


________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
Thats great! Zion7. Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top