fenumwindows and maximize form

  • Thread starter Thread starter Colin Beckingham
  • Start date Start date
C

Colin Beckingham

I'm using Dev's code (http://www.mvps.org/access/api/api0013.htm) to
enumerate the windows in Access97 to check whether there are already
instances of an app running, and to stop other instances from loading. I
have put my code in the open event of the main form.

All works fine until I add a line
docmd.maximize
to maximize the form as it loads. This line comes after the enumeration
check.

Comment out this line and the instances check works fine, leave it in and of
course the window maximizes but I can load as many instances of the app as I
like. Maximizing the form seems to stop the enumeration.

Strangely it will work about one time in 25 or so, but very unpredictably. I
have rebooted etc etc, but nothing changes.
 
Colin,

These are just possiblities to consider. I have never tried what you are
doing.

You could try putting the DoCmd.Maximize in the Form_Activate event rather
than Form_Load.

Alternatively you could start the program using the AutoExec Macro and open
the main form after you had checked for an instance of the program.

Rod Scoullar.
 
Back
Top