Test if form is open

G

Guest

I am able to pop up a form ("Form2") by clicking a button from another form
("Form1"), and populate Form2's textboxes from Form1. But it's also possible
to pop up Form2 directly, from the "Forms" screen. How do I test if Form1 is
actually open onscreen? When it's closed, it seems to still have all its
current data from the last time it was opened, and properties like
application.CodeProject.Forms("Form1").IsLoaded or Form_Form1.Visible don't
give this information.
 
G

Guest

You can test to see if a form is already open different ways depending on
what version of access you are using.

Check out

http://www.mvps.org/access/forms/frm0002.htm

For newer version of access you can simply use the 'IsLoaded' to check. For
instance

if forms![YourFormName].isloaded = true then
msgbox "this form is open"
elseif forms![YourFormName].isloaded = false then
msgbox "this form is not open"
endif

Hope this helps,

Daniel
 
G

Guest

Also, you can use the 'Screen.ActiveForm.Name' to determine which form
currently has the focus.

Daniel
 

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