469,600 Members | 2,497 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

Resize Parent Form on The Fly

I am building a wizard and have an issue with one sub form. Whilst all others are about 5 fields tall this one is 15 fields.

My choices are either to resize the parent form ridiculously large for the other forms or resize the parent form on loading this subform.

I have tried the following:

Expand|Select|Wrap|Line Numbers
  1.  Me.Parent.Form.Section(acDetail).Height = 1.4 * Me.Parent.Form.Section(acDetail).Height
  2.  
  3.     'Me.Parent.Form.Section(acDetail).Repaint
  4.  
  5.     Me.Parent.Form.Repaint
This is in the Form load event of the subform, but doesn't work. I have been trying various iterations of this and can't get it to work.

Anyone got some code that works?
Feb 25 '08 #1
2 2777
Zwoker
66
Hi,

For what its worth I have some code that resizes the whole form when I need it. The code resides in my Form_Activate event. I run MS Access 2003. Maybe it will be of some help?

Expand|Select|Wrap|Line Numbers
  1. Const conInchesToTwips = 1440
  2.  
  3. Me.Move Left:=Me.WindowLeft, Top:=Me.WindowTop, Width:=3.8 * conInchesToTwips, Height:=5.9 * conInchesToTwips
I seem to recall there are some rules for using the Move method. Such as it not being allowed on Modal forms? Help for the command in your version of MS Access should give you the answers, if the method is of any use to you.


Regards,
Zwoker.
Feb 25 '08 #2
ADezii
8,800 Expert 8TB
I am building a wizard and have an issue with one sub form. Whilst all others are about 5 fields tall this one is 15 fields.

My choices are either to resize the parent form ridiculously large for the other forms or resize the parent form on loading this subform.

I have tried the following:

Expand|Select|Wrap|Line Numbers
  1.  Me.Parent.Form.Section(acDetail).Height = 1.4 * Me.Parent.Form.Section(acDetail).Height
  2.  
  3.     'Me.Parent.Form.Section(acDetail).Repaint
  4.  
  5.     Me.Parent.Form.Repaint
This is in the Form load event of the subform, but doesn't work. I have been trying various iterations of this and can't get it to work.

Anyone got some code that works?
I hate to be the bearer of bad news but your code will never work, since Form Section Properties can only be modified in Form Design View. What you essentially need to do is to Close the Main Form, Open it in Design View, change the Detail Section dimensions, and the Open it again as in:
Expand|Select|Wrap|Line Numbers
  1. 'Assuming your Main Form is frmMain, and you are executing this code from an Event within the Sub-Form:
  2. DoCmd.Close acForm, "frmMain"
  3. DoCmd.OpenForm "frmMain", acDesign
  4.   'Make changes while in Form Design View
  5.   Application.Echo False
  6.     Me.Parent.Form.Section(acDetail).Height = 1.4 * Me.Parent.Form.Section(acDetail).Height
  7.   Application.Echo True
  8. DoCmd.OpenForm "frmMain", acNormal, , , acFormEdit
Feb 26 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Ian Stiles | last post: by
3 posts views Thread by Z D | last post: by
6 posts views Thread by Ty Salistean | last post: by
reply views Thread by Patrick Lioi | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.