How do I size a form with code??

Debased

Registered User.
Local time
Today, 12:56
Joined
Mar 11, 2004
Messages
112
I have a form that I use as a switchboard. On Open, it is sized to whatever size it was saved as the last time it was opened. One command button on the switchboard opens a query and when you maximize the window for the query and then close the query, the switchboard form is also maximized. I know I have seen this explained before but cannot recall how you resize a form with code so that it always displays at the same size (and not maximized!) and what event to place the code in.

Thanks again for all your help! :)
 
Well, if I'm following you correctly you can try something like this in the event procedure of your command button that will open a query:

DoCmd.OpenQuery "Query1", acNormal, "", "", , acNormal
DoCmd.MoveSize 5000, 2000, 5000, 5000

The numbers correspond to:
DoCmd.MoveSize Right, Down, Width, Height

HTH
 
Oops. Guess I was a little too late with the response. I like WayneRyan's much better. :) That's a very nice sample database there.
 
Debased said:
I know I have seen this explained before but cannot recall how you resize a form with code so that it always displays at the same size (and not maximized!) and what event to place the code in.
Here is some code I use in the forms OnOpen event to force my forms to the size I want...
Code:
'    MsgBox "InsideHeight = " & InsideHeight & vbCrLf & vbLf & "InsideWidth = " & InsideWidth 'used for testing
    InsideHeight = 5000 'twips
    InsideWidth = 6000 'twips
 

Users who are viewing this thread

Back
Top Bottom