test for open form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way, in a query, to test tosee if another form is open? I tried
iif(iserror(fornA),"",3) but I still get an error if formA is not open.
thanks
 
You can use the SysCmd function.

SysCmd(acSysCmdGetObjectState, acForm, "frmA") will return 0 if the form is
closed, or a non-zero value if it's open. However, you can't use the
intrinsic constants acSysCmdGetObjectState and acForm in a query: you'll
have to use their numeric values instead:

SysCmd(10, 2, "frmA")
 
Thanks much. Your suggestion worked great - almost. It does return a value
to let me know if the form is orprn or not and I can evaluate a field on the
open form. Now what I need is a way to have something like ">0" substituted
for the value in the criteria line of the query instead of the value on the
open form. what I mean is that if the form is open I am able to substitute
the value, such as a number from 1 to 30 in the criteria line. when the form
is closed I want the query to return all values, not just the one from the
open form. thanks again.
 
Back
Top