By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,401 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,401 IT Pros & Developers. It's quick & easy.

How to resize form from code?

P: n/a
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips(2)
'End of Code

Thanks
Dustin Wilson
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Mon, 9 Feb 2004 09:40:51 -0600, "Dustin Wilson"
<dw*****@REMOVE.kgsgroup.com> wrote:
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips(2)
'End of Code

Thanks
Dustin Wilson


You can use DoCmd.MoveSize for this purpose.

- Jim
Nov 12 '05 #2

P: n/a
"Dustin Wilson" <dw*****@REMOVE.kgsgroup.com> wrote in
news:IT*****************@news1.mts.net:
runtime? Or is there a way to execute the command "Size to Fit Form"
from the menu.


Private Sub Form_Load()
With DoCmd
.Restore
.RunCommand acCmdSizeToFitForm
End With
End Sub

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3

P: n/a
Lyle

Works perfectly. Exactly what I wanted. :)

Thanks
Dustin

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.17...
"Dustin Wilson" <dw*****@REMOVE.kgsgroup.com> wrote in
news:IT*****************@news1.mts.net:
runtime? Or is there a way to execute the command "Size to Fit Form"
from the menu.


Private Sub Form_Load()
With DoCmd
.Restore
.RunCommand acCmdSizeToFitForm
End With
End Sub

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #4

P: n/a
"Dustin Wilson" <dw*****@REMOVE.kgsgroup.com> wrote in message news:<IT*****************@news1.mts.net>...
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips(2)
'End of Code

Thanks
Dustin Wilson


To execute the Size to Fit Form command programatically ...

DoCmd.RunCommand acCmdSizeToFitForm

--
Brendan Reynolds
Nov 12 '05 #5

P: n/a
Justin,

Try DoCmd.MoveSize, which will allow you to control the position of
the current window. if you are executing code in a the Form_Load
event, it should work OK. I haven't tried it on a subform, so I am not
sure how that would work.

If you are distributing your application, check out some of the
discussions on sizing as it relates to screen resolution. They may be
helpful, if that is what you are doing.

James Neumann
"Dustin Wilson" <dw*****@REMOVE.kgsgroup.com> wrote in message news:<IT*****************@news1.mts.net>...
I would like to resize the height of a form through a piece of code. I
tried the following piece of code but got an error saying it was a read only
property and can't be set. Is there a was to resize the form at runtime?
Or is there a way to execute the command "Size to Fit Form" from the menu.

'Start of Code
Me.WindowHeight = fInchesToTwips(2)
'End of Code

Thanks
Dustin Wilson

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.