How to tell if form is open

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

How can I run a test to see if one of two different forms are open or not in
vba code?

Thanks

Joe
 
Dear Joe:

There is code here:

http://www.mvps.org/access/forms/frm0002.htm

Also, here is a function from the Northwind Traders sample database:

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

Set oAccessObject = CurrentProject.AllForms(strFormName)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If

End Function

HTH
Fred Boer
 
Back
Top