Testing is a Forn is open

A

Andy Levy

Hi

Do you know how i can test if a particular form is open in access2k

Is it as simple as

If (formname) then
**Statement**
End If


Thanks
 
P

PC Datasheet

Andy,

Go to the Northwind Traders sample database. There's a function called IsOpen in
the standard modules that does this.

PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
 
N

Neil

If you are using Access2K then

If CurrentProject.AllForms("FormName").IsLoaded Then
' Form is open
End If

may be easier.

HTH,

Neil.
 
D

Dan Artuso

Hi,
Here is a function that comes with the Northwind sample db:

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

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If

End Function
 

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