how to check form open

accessman2

Registered User.
Local time
Today, 15:42
Joined
Sep 15, 2005
Messages
335
Hi,

I want to write a function, which is checking whether or not the form "Operating form" is opened?

if [Form_Operating form].??? = True then
msgbox "the form is opened now"
end if

Does anybody know that?
 
Search here for "isloaded".
 
except is loaded, I want to check whether the form is active by user, because the user may open the multiple forms, I want the program to do something for the active form only.

How can I check whether or not the specific form is activated by user?
 
this function determines whether an object is open. Default type is form - if you want to check a query call it with acquery as a parameter etc.

Function IsOpen(strName As String, Optional objtype As Integer = acForm)
IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function

ie usage isopen("myformname")
or isopen("myreportname",acreport)

----------------------------------
the current form is activeform - this is from access help

Dim frmCurrentForm As Form
Set frmCurrentForm = Screen.ActiveForm
MsgBox "Current form is " & frmCurrentForm.Name

-----------------------
Unless I am misunderstanding your post, it sounds like you have multiple users using the same copy of a database, which is not the best thing to do - loads of threads here about that very thing.
 
Last edited:
Try this:
Public Function ISOPENFORM(cFrmName As String) As Boolean
Dim ObjDb As Object, ObjFrms As Object
Set ObjDb = Application.CurrentProject
Set ObjFrms = ObjDb.AllForms
ISOPENFORM = ObjFrms(cFrmName).IsLoaded
End Function
 
re:

Hi,
If you use Acc2000 or higher you do NOT need to define a UDF anymore. All that is required would be:

If CurrentProject.AllForms("YourFormName").IsLoaded Then
...

HTH
Good luck
 

Users who are viewing this thread

Back
Top Bottom