background form changes its size

novo

New member
Local time
Today, 04:45
Joined
Sep 4, 2008
Messages
9
Hi all!
I have a well-known problem wich hase been disscussed widely in forums but with a slightly ambiguity that i can`t figure out.
In my database i have the main form wich is maximized on opening the base. After this you can run another forms from the main form menus wich are modal, pop-up forms.
So, after you run the report from one of theese forms and close the report window - the main form on the background wich was maximized changes its size and shrinks :mad:
I would even appreciate any principal approaches to decide this problem.

Thanks in advance!
 
Re-size the main form when the poup-up modal form closes, i.e.

on the form_close event

'before closing the popup-modal, resise the mainform
forms!MainFor.setfocus
docmd.movesize right, down, width, height
me.setfocus
docmd.close
 
Re-size the main form when the poup-up modal form closes, i.e.

on the form_close event

'before closing the popup-modal, resise the mainform
forms!MainFor.setfocus
docmd.movesize right, down, width, height
me.setfocus
docmd.close

thanks a lot for the advice - i`ll sure try to apply it, but there are things - if you don`t mind, wich confuse me:
1) i don`t need to close the little pop-up form shown above the main background maximized form till i use the report functionality;
2) Width and Height - as i comprehend, theese are fixed parameters of my screen size. So it looks like i need to elaborate the code independent from the Maximize function wich will be fitting any screen by determining its size (some kind of "serious programming")?

thanks in advance for any advices!!!
 
If the main form is resizing as a result of the popup opening, on the Popup_Load even setfocus to the main form, resize it, then set focus back to the popup.

PHP:
sub Form_Load()
forms!Mainform.setfocus
docmd.movesize . . .
forms!Popup.setfoucs
end sub
 
Ta-dam!!!
I`ve got it! With no need to determine any sizes and with constantly maximized background form!!! So, everething you need:

In separate module:
Public Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long

Public Const SW_MAXIMIZE = 3

And in on_close event of a nasty report wich makes the background to change:

Dim F As Form
Set F = Application.Forms(Main)

If IsZoomed(F.hWnd) = 0 Then
ShowWindow F.hWnd, SW_MAXIMIZE
End If
 

Users who are viewing this thread

Back
Top Bottom