Find if a Form is Open

  • Thread starter Thread starter Daniel Zazula
  • Start date Start date
D

Daniel Zazula

If this is not the correct newsgroup please direct my to the right
one.

I'm extending a legacy application at my work and I've created a macro
that perform a specific task, there are two different forms that can
call this macro, only one of them will be open at the moment the macro
is called, for the macro to perform his task the first query of the
macro needs a ID number from one of the forms. So is there a way to
test which one of the forms are open? Something like:
case
when IsOpen(Forms.Form1) then Forms.Form1.ID
when IsOpen(Forms.Form2) then Forms.Form2.ID
end as MyID
 
Test like this:
CurrentProject.AllForms("Form1").IsLoaded

Note that this only tells you if Form1 is open in its own right, i.e. it
returns False if Form1 is open as a subform.
 
Just duplicate the macro for each form, giving them different names. Then you
can use a custom query in each macro.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
Thanks Allen, I will try that.

I was just trying to avoid this kind of thing Dorian

Also I though of another way, if a create a Parameter in the query,
ObjID for example, and I could pass the value through a call from a
form or from a macro
 
Back
Top