Can anyone tell me how to tell if a given form is open in code? Was thinking there may be something like an IsOpen property, but that would give you an error if the form was closed. Is there a method that will accept a form name and return true if the form is open, like IsOpen(formname)? What I want to do with it is
IF form is open THEN
statements
ELSE
more statements
ENDIF
Alternatively, perhaps someone has a different solution to my entire problem. What I'm using this for is a toggle button to open or close a form (filter) from a button on another form (main). If filter is closed, the button label on main says "show filters" and if it is open the button shows "hide filters". This'll need to be done in OnOpen and OnClose form events in filter, as the user can close the filter form manually as well as using the button. The button code needs to decide whether to try and open or close the form. I could do it with error trapping - try to close the form, and if you get an error, open it instead, but that's dodgy programming practice. Any better ideas?
-Iainm
IF form is open THEN
statements
ELSE
more statements
ENDIF
Alternatively, perhaps someone has a different solution to my entire problem. What I'm using this for is a toggle button to open or close a form (filter) from a button on another form (main). If filter is closed, the button label on main says "show filters" and if it is open the button shows "hide filters". This'll need to be done in OnOpen and OnClose form events in filter, as the user can close the filter form manually as well as using the button. The button code needs to decide whether to try and open or close the form. I could do it with error trapping - try to close the form, and if you get an error, open it instead, but that's dodgy programming practice. Any better ideas?
-Iainm