Hi All
WinXPPro
Access 2002 SP3
I have a Main form with a series of SubForms. I've had lot of fun trying to run commands against the SubForms from the Main form... Is the form open? Does it have a valid recordsource? Are there any records in it? Do I test for Nulls etc etc ... I'm sure you've been there!
I thought I'd write myself a little module based on some great advice I've seen in this forum and other web pages, using SysCmd. This will save me a ot of time I thought ... but I can't get the expected results. The SysCmd call against my forms always returns 0 (closed object) even when I am staring at the open form! And my eyesight is not so good!
Here's the code I am using:
---------------------------------------------------------
Public Function My_Form_Check(Form_To_Test As Form, Mode As String) As Long
On Error GoTo err_My_Form_Check
Dim Form_Open_Value As Integer
My_Form_Check = -99 'Not open
Form_Open_Value = SysCmd(acSysCmdGetObjectState, acForm, Form_To_Test.Name)
If Form_Open_Value = 0 Then 'Not open
'leave at -99
GoTo exit_My_Form_Check
End If
Further code .......................
-----------------------------------------------
I have Msgbox'd the form.name and it returns (what I think is) a valid name, e.g.
"System_Settings_History_Notes_SubForm"
Any idea why SysCmd cannot see the form as open?
Thanks
WinXPPro
Access 2002 SP3
I have a Main form with a series of SubForms. I've had lot of fun trying to run commands against the SubForms from the Main form... Is the form open? Does it have a valid recordsource? Are there any records in it? Do I test for Nulls etc etc ... I'm sure you've been there!

I thought I'd write myself a little module based on some great advice I've seen in this forum and other web pages, using SysCmd. This will save me a ot of time I thought ... but I can't get the expected results. The SysCmd call against my forms always returns 0 (closed object) even when I am staring at the open form! And my eyesight is not so good!
Here's the code I am using:
---------------------------------------------------------
Public Function My_Form_Check(Form_To_Test As Form, Mode As String) As Long
On Error GoTo err_My_Form_Check
Dim Form_Open_Value As Integer
My_Form_Check = -99 'Not open
Form_Open_Value = SysCmd(acSysCmdGetObjectState, acForm, Form_To_Test.Name)
If Form_Open_Value = 0 Then 'Not open
'leave at -99
GoTo exit_My_Form_Check
End If
Further code .......................
-----------------------------------------------
I have Msgbox'd the form.name and it returns (what I think is) a valid name, e.g.
"System_Settings_History_Notes_SubForm"
Any idea why SysCmd cannot see the form as open?
Thanks