Form maximize problem

G

Guest

I have a form which is maximized on open with Docmd.Maximize.
I have a few command buttons to preview reports on that form.
Whenever I preview a report and close the report, the form is no longer
maximized.
How can I keep the form maximized after preview of a form?
 
R

RB Smissaert

If you have/can get the hwnd of that form then this will do it:

Private Declare Function SetWindowLong _
Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As
Long
Private Declare Function ShowWindow _
Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Sub MaxWindow(lHwnd As Long)

ShowWindow lHwnd, 0
SetWindowLong lHwnd, -20, &H40101
ShowWindow lHwnd, 3

End Sub

RBS
 
G

Guest

Hi Marco -- In addition to what RB recommended, you can also try moving the
code to the On Load event...
 

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

Similar Threads

Window Sizing Question 11
Weird Problem with DoCmd.Maximize 2
Maximize 1
Maximize Form 1
Maximize Question 3
open form NOT maximized 2
Maximize a form 1
Excel VBA - Problem with Closing Print Preview 0

Top