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

Resize Parent Form on The Fly

P: 4
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
Share this Question
Share on Google+
2 Replies


Zwoker
P: 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
Expert 5K+
P: 8,701
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.