472,131 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,131 software developers and data experts.

How to resize form from code?

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
5 31884
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
"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
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
"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
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.

Similar topics

2 posts views Thread by tom | last post: by
1 post views Thread by guy | last post: by
1 post views Thread by Peteroid | last post: by
5 posts views Thread by =?Utf-8?B?cm9nZXJfMjc=?= | last post: by
3 posts views Thread by zacks | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.