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

How to check if form is open with VBA? 2

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Will someone please send me a vba code sample of how to check if a form is open in the background?

Thx in advance.

Steve728
 
How are ya steve728 . . .
Code:
[blue]   If Currentproject.AllForms("FormName").IsLoaded Then
      [green]'Form Open code here[/green]
   Else
      [green]'Form Closed code here[/green]
   End if[/blue]

Calvin.gif
See Ya! . . . . . .
 
and a couple of others...
_______________________________________
Sub LoadedForms()
'outputs all loaded forms
Dim frm As Form

For Each frm In Forms
Debug.Print frm.Name
Next frm

End Sub

____________________________________
Sub SysLoaded()
'Code sample from Accessory 'There are four states you can check for:
'acObjStateOpen - open
'acObjStateNew - new
'acObjStateDirty - changed but not saved
'0 (zero) - closed or non-existant

If SysCmd(acSysCmdGetObjectState, acForm, "frmSales") = acObjStateOpen Then DoCmd.Close acForm, "frmSales", acSaveYes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top