How to tell if form is open

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
 
F

Fred Boer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top