Repositioning A Subform

M

mmmbl

I have a form with with two to overlapping subforms. By default the
sfrm_MonthlyGroceryFamiles is visible. If I choose the Group Option in an
option box the sfrm_MonthlyGroceryFamiies becomes visible, and the subform
for the non-grouped items is selected, I have a 3rd option which the BOTH
option. What I what wanted to do was shrink the size of the Group subform and
then reposition the NonGroup option right below it and both becomes visible.
I get a "Run-Time error 2100 The control or subform control is too large for
this section" when i clicked on the Both option. What's wrong with the code?
To get the exact positions and sizes of the subforms I manually resize and
move them temporarily so i can get the measurements.

Me.sfrm_MonthlyGroceryFamilies.Visible = True
Me.sfrm_MonthlyGroceryFamilies.Left = 3.9167 * 1440
Me.sfrm_MonthlyGroceryFamilies.Top = 0.3333 * 1440
Me.sfrm_MonthlyGroceryFamilies.Width = 5.4383 * 1440
Me.sfrm_MonthlyGroceryFamilies.Height = 3.0417 * 1440

Me.sfrm_MonthlyGroceryNonFamily.Visible = True
Me.sfrm_MonthlyGroceryNonFamily.Left = 3.9167 * 1440
Me.sfrm_MonthlyGroceryNonFamily.Top = 3.7083 * 1440
Me.sfrm_MonthlyGroceryNonFamily.Width = 5.4583 * 1440
Me.sfrm_MonthlyGroceryNonFamily.Height = 2.7083 * 1440
 
T

tina

you might find it easier to add a tab control to your form, and put each
subform on a different tab page. you can use the option group to display one
tab page, or the other, or both.

hth
 
S

Svetlana

You possibly need to resize the detail section first then change the
InsideHeight to the details new height as like

Me.Detail.Height = Me.Detail.Height * 3
Me.InsideHeight = Me.Detail.Height

Me.sfrm_MonthlyGroceryFamilies.Height = 3.0417 * 1440

Me.sfrm_MonthlyGroceryNonFamily.Height = 2.7083 * 1440

Dim intLeftPosition As Integer
intLeftPosition = Me.sfrm_MonthlyGroceryFamilies.Left

Dim intTopPosition As Integer
intTopPosition = Me.sfrm_MonthlyGroceryFamilies.Height +500

Me.sfrm_MonthlyGroceryNonFamily.Move intLeftPosition , intTopPosition
 
M

mmmbl

but if you add the heights of the form then it should total to the same
height of one of the forms when shown by itself.
 
M

mmmbl

Svetlana said:
You possibly need to resize the detail section first then change the
InsideHeight to the details new height as like

Me.Detail.Height = Me.Detail.Height * 3
Me.InsideHeight = Me.Detail.Height

Me.sfrm_MonthlyGroceryFamilies.Height = 3.0417 * 1440

Me.sfrm_MonthlyGroceryNonFamily.Height = 2.7083 * 1440

Dim intLeftPosition As Integer
intLeftPosition = Me.sfrm_MonthlyGroceryFamilies.Left

Dim intTopPosition As Integer
intTopPosition = Me.sfrm_MonthlyGroceryFamilies.Height +500

Me.sfrm_MonthlyGroceryNonFamily.Move intLeftPosition , intTopPosition

This adjusting the height works but instead of just multiplying it, at the end I reset the form height back to the original height of the form.
Thanks for the recommendation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top