Need some code to see if a form is already open.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey all,

So here is what is going on. There is a button on a form that opens another
form. Now this form is based on several queries, and is kinda sensitive, so
through the day pressing that button to run a macro that opens it up, isnt
quite a good idea =). What I am wondering, is if there is some VBA code I can
do that will prevent the macro from rerunning, and just give me a message box
saying "hey, the window is already up dork!". Is that possible at all?
 
If you're using ACCESS 2000 or higher, you can use a Condition to test this:

MacroName

Condition: CurrentProject.AllForms("NameOfYourForm").IsLoaded = False
Action: MsgBox
Message: Form is already open.

Condition: . . .
Action: StopMacro
 
Back
Top