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

Is form open in background? 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Please provide me with a code sample of how to detect if a form is open in the backgrund or not.

Thanks,

Steve728
 
How are ya steve728 . . .

In a module in the modules window, copy/paste the following function:
Code:
[blue]Function IsOpenForm(frmName As String) As Boolean
   Dim cp As CurrentProject, Frms As Object
   
   Set cp = CurrentProject()
   Set Frms = cp.AllForms
   
   If Frms(frmName).IsLoaded Then
      [green]'If form not in Design View then OK![/green]
      If Forms(frmName).CurrentView > 0 Then IsOpenForm = True
   End If
   
   Set Frms = Nothing
   Set cp = Nothing

End Function[/blue]
The functions returns true if the form is not open in design view.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top