Stopping a macro if a form is not open

R

Rob

I would like to stop a macro running if a form isn't
open, any suggestions?

Regards

Rob
 
K

Ken Snell

You can't do directly in a macro, but you can use VBA function and call it
from the macro to see if the function says the form is open or not.


The ACCESS Web has a function that will return a value to tell you if the
form is open or not:
http://www.mvps.org/access/forms/frm0002.htm


Put the function shown there in a regular module (name the module
basFunctions).

Then use a condition similar to this in your macro:

Condition: fIsLoaded("FormName") = -1


The above condition will be true if the form is open.
 

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