Find if a Form is Open

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
 
A

Allen Browne

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.
 
D

Dorian

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".
 
D

Daniel Zazula

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top