Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I set the Form size at runtime...?

Status
Not open for further replies.

SRFRIO

Programmer
Mar 2, 2001
8
US
For you info: Border Style is set to sizable ( I wonder if that helps).
TIA
SRFRIO
 
If you want to simulate the Window>Size To Fit Form menu option, use the statement DoCmd.RunCommand acCmdSizeToFitForm.

If you want to set the form to a calculated size, set the Form's Width property, and the detail section's Height property. Sample code:
Code:
    Me!Width = 3.5
    Me!Section(acDetail).Height = 5.0
Rick Sprague
 
It seems not to work. More details...
I've got a setup Form where you can set a file name and a batch file to execute before import a text file; also in the bottom of the Form you can setup column n# to be imported, this section of column setup must be hidden until you press the Setup Columns toggle button. I need to add code to that button to increase or decrease the size of the Form to hide or unhide that column setup section .

TIA
SRFRIO
 
You mean like the way the Access Startup dialog box expands when you click the Advanced... button? Ok.

This is actually changing the window size, not the form size. The form is what displays inside the window, and has controls on it. The window is basically just the frame.

If you make the form longer, the extra space will be empty (no controls), and will still be hidden unless you also enlarge the window. It's as if the window was a viewport through which you're looking at the form. If the form is bigger than the window, you have to enlarge the window to see more of the form.

Changing the window size is easy: just set the form's WindowHeight and WindowWidth properties at run time. You'll have to experiment a little bit to get the size right. Or, you can use the Size To Fit Form command as I mentioned above to make the window bigger (but not smaller). Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top