Test if a form is open then close it

David Mack

Registered User.
Local time
Today, 00:59
Joined
Jan 4, 2000
Messages
53
I know I've seen this somewhere before...

What I need to do is test if a form is open (which could be true or false depending on the user's circumstances) and close programically it if a true is returned.

I know how to test if a table exists in the tabledefs collection and then delete the table, but I cannot find out how to close a form if it is detected as open.

Thank you,

Dave Mack
 
Found it in the developer's handbook.
If the form "frmSurvey" is open, IsOpen returns a -1. Then close it.

Dim IsOpen As Integer

IsOpen = SysCmd(acSysCmdGetObjectState, acForm, "frmSurvey")
If IsOpen <> 0 Then
DoCmd.Close acForm, "frmSurvey", acSaveYes
End If

Dave Mack
 

Users who are viewing this thread

Back
Top Bottom