Maximize On Activate

samjesse

Registered User.
Local time
Yesterday, 16:06
Joined
Feb 13, 2009
Messages
64
Hi

I have both Office 2000 and 2007 on XP.

This Access 2000 database is producing an error, when it first starts it opens a Form which has an event as below. Is there a fix please? Thank you

Code:
Private Sub Form_Activate()
'Maximize the form and Sets size of forms
    DoCmd.Maximize
   

End Sub
 
Move that code to the On Load event of the form instead.
 
There's nothing wrong with this being in the Form_Activate event, it should work fine there. But in order to help you we need to know what error it's producing. Also, is there any other code in the Activate event?
 
I was thinking since the Maximize method only maximizes the active window, the open or load event would be the most appropriate for handling this.
 
I use the forms OnOpen event when I am doing stuff that affects the form.

When you first open a form, the following events occur in this order:
Open → Load → Resize → Activate → Current
http://msdn.microsoft.com/en-us/library/aa211439(office.11).aspx

This will maximize the application...
DoCmd.RunCommand acCmdAppMaximize

This maximizes the current form...
DoCmd.Maximize
 
The Open Form event would be fine, but the Activate works, too. Using the Activate event will maximize the form, for instance, when the form opens and if you navigate away from the form, minimizing it, then later return to the form.

I doubt that the error is actually being popped by the maximizing code, which is why the OP needs to post the actual error as well as other code they're using.
 
There's nothing wrong with this being in the Form_Activate event, it should work fine there. But in order to help you we need to know what error it's producing. Also, is there any other code in the Activate event?

I tried Form_Open as suggested by others for no avail. It gave the same error which is:

"Object or class does not support the set of events"

It is the only code in the Form_Activate.
 
deleted for duplication.
 
Last edited:
You need to post all the code you are using in the offending form unless you want to post your db [minus any data]. Something is conflicting and we cannot help without seeing it.

If you click the Debug Compile option, does anything trigger an error?

Ensure you have these two statements at the top of all your modules...

Code:
Option Compare Database
Option Explicit
 
The Open Form event would be fine, but the Activate works, too. Using the Activate event will maximize the form, for instance, when the form opens and if you navigate away from the form, minimizing it, then later return to the form.
You're correct and I'm actually aware of that. I thought maybe the method was being called unecessarily which was causing the problems.

I doubt that the error is actually being popped by the maximizing code, which is why the OP needs to post the actual error as well as other code they're using.
I agree with that.

Also, when the error message pops-up the OP should click the DEBUG button and show the line of code that is highlighted in yellow.
 
OK. I would like to post the whole database without the data. I have 2 files for this database "since it is linked tables", DAS.mdb and DAS_be.mdb.

If I post the DAS.mdb, would that not post the data?

thx
 
OK. here is the database. BTW. all works OK when I run it in another machine running windows 2000 OS.

the problem is with other machines running XP with office 2000 installed.
 
I would suggest opening it on that machine and then going to the VBA window and then going to DEBUG > COMPILE <yourprojectnamehere> and it might shed some light on things.
 
ops. could not upload it since it was bigger than max. allowed. for mdb or zip.
 
I would suggest opening it on that machine and then going to the VBA window and then going to DEBUG > COMPILE <yourprojectnamehere> and it might shed some light on things.

I get Compile Error: User-defined type not defined.
the blue highlight is on
DialParams As LINEDIALPARAMS

in Telephony module.
 
I get Compile Error: User-defined type not defined.
the blue highlight is on
DialParams As LINEDIALPARAMS

in Telephony module.

That would be a dll, ocx or olb that isn't registered on that machine.
 

Users who are viewing this thread

Back
Top Bottom