Resize sub forms (1 Viewer)

Gismo

Registered User.
Local time
Tomorrow, 01:12
Joined
Jun 12, 2017
Messages
1,298
Hi all,

Is it possible or rather, an easy way to resize subforms to full screen depending on the size of the users screen?
when some users have smaller screens, they have to use the slide bars to see all the data on the form and sub forms
and other users that has larger screen, the forms visible in the top left and bottom and right is all blank
 

theDBguy

I’m here to help
Staff member
Local time
Today, 16:12
Joined
Oct 29, 2018
Messages
21,358
Hi. Are we talking about datasheet subforms?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 16:12
Joined
Oct 29, 2018
Messages
21,358
In that case, I would give Anchoring a try first.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:12
Joined
May 7, 2009
Messages
19,169
Can it be used on normal form, with ribbon and not Headless form.
 

Gismo

Registered User.
Local time
Tomorrow, 01:12
Joined
Jun 12, 2017
Messages
1,298
In that case, I would give Anchoring a try first.
I tried that

does not seem to work

i have a form with a subform and 2 forms withing the subform

seems like access does not know how to handle this

on all forms if selected auto center, auto resize and fit to screen
as well as can grow and can shrink

i have gaps between the sub forms and it does not grow to max size

i tried first subform as anchor to top and second subform anchor to bottom

when is display on a smaller screen, all the forms have the sliding bar activated
when I display on the larger screen, all fits in perfext
when displaying on an even bigger screen, everything is cropped up with blank spaces
 

theDBguy

I’m here to help
Staff member
Local time
Today, 16:12
Joined
Oct 29, 2018
Messages
21,358
I tried that

does not seem to work

i have a form with a subform and 2 forms withing the subform

seems like access does not know how to handle this

on all forms if selected auto center, auto resize and fit to screen
as well as can grow and can shrink

i have gaps between the sub forms and it does not grow to max size

i tried first subform as anchor to top and second subform anchor to bottom

when is display on a smaller screen, all the forms have the sliding bar activated
when I display on the larger screen, all fits in perfext
when displaying on an even bigger screen, everything is cropped up with blank spaces
Hi. Sorry to hear that. To help us get the big picture, can you post some screenshots? Thanks.
 

Gismo

Registered User.
Local time
Tomorrow, 01:12
Joined
Jun 12, 2017
Messages
1,298
Hi. Sorry to hear that. To help us get the big picture, can you post some screenshots? Thanks.
on the large screen, everything fits in
1598964482455.png


on the smaller screen, i have to scroll on the main form

1598964531427.png


i do not have the larger screen connected now, but everything is cropped to the left and top with spaces at the bottom
 

isladogs

MVP / VIP
Local time
Today, 23:12
Joined
Jan 14, 2017
Messages
18,186
Did you try automatic form resizing? See link in post #5.
 

Gismo

Registered User.
Local time
Tomorrow, 01:12
Joined
Jun 12, 2017
Messages
1,298
Did you try automatic form resizing? See link in post #5.
I read the article but our company prevented the example application site from being opened so i tried the anchoring option

could you please post the module code if possible?
 

isladogs

MVP / VIP
Local time
Today, 23:12
Joined
Jan 14, 2017
Messages
18,186
I read the article but our company prevented the example application site from being opened so i tried the anchoring option

could you please post the module code if possible?

Hi
I'd love to but the resizing code is a lengthy module and far too long to post here.
The code is fairly complex but using it requires just one line of code per form: ResizeForm Me
However, earlier versions of the code and app are also available here at
Can you download from here? Otherwise perhaps try downloading from home
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:12
Joined
Feb 19, 2013
Messages
16,553
to resize a subform use the form resize event.

Assuming your form does not have header or footer sections and you have positioned the subform to the correct Left and top coordinates your code would be something like

subformname.height=insideheight-subformname.top-60
subformname.width=insidewidth-subformname.left-60

the -60 is just to allow a 1mm margin. Remove or change as required

if your form does have header or footer sections or controls below adjust the (height) above accordingly. From your pictures it looks like you have two subforms and it is the top one you want to adjust - so deduct the height of the bottom one.
 

Gismo

Registered User.
Local time
Tomorrow, 01:12
Joined
Jun 12, 2017
Messages
1,298
Hi,

my ResizeForm Me function worked well but as i am going through my forms, adding the ResizeForm Me on load, i cam across one of my forms going haywire.

this is what the form should look like before resize implemented
1599637922355.png


but when I load ResizeForm Me
this is how the form displays

1599638028319.png
 

vhung

Member
Local time
Today, 16:12
Joined
Jul 8, 2020
Messages
235
AccdbForm is the main object of Access when comes to browsing/entry of data
>if you use the "Overlapping" settings through the Privacy Options of current database
probably that would happened problems on size not properly pop.up
>but maybe try to use "Tabbed" settings, before i hate to use it, but now it is the best selection settings for me
because it is manageable and stable position of AccdbForms, Pop-up Form still be applicable
>i made already Form click resize but this depend on the data you need to show could be Resize datasheet on the main form

"subformname.height=insideheight-subformname.top-60"
"subformname.width=insidewidth-subformname.left-60"

this is applicable but not at all times, maybe on a little form alone
 

isladogs

MVP / VIP
Local time
Today, 23:12
Joined
Jan 14, 2017
Messages
18,186
@Gismo
Remember that resizing code applies to both the form and all controls on it ...including subforms

It looks to me like you are using a subform on a tab control and that you have applied the form resizing code to both.
As subforms are loaded first, that will be resized and repositioned
Then when the main form code runs, the subform is resized and repositioned again
This means the results may not be what you expect.

Tab controls are particularly tricky to get right, especially those with subforms.

This is a quote from the third page of my web article:
The Resize procedure gives ‘special treatment’ to selected controls – list boxes, combo boxes and tab controls - to manage their individual features.
Tab control pages are excluded as are the contents of subforms (the subform container is resized automatically)

As previously stated, the code line ResizeForm Me needs to be added to each form being resized.
This code line means the ResizeForm procedure is applied to the loaded form (Me)

To scale up the subform control positions / sizes, add the line ResizeForm Me to the Form_Load event of the subform.
Alternatively, add a line like ReSizeForm subFormName.Form to the Form_Load event of the main form ....

NOTE: DO NOT DO BOTH METHODS or the subform will be scaled up twice!!

If that doesn't help, try the following - one step at a time...as necessary..and observe the results
1. Comment out the resizeform me line in the subform
2. Slightly tweak the position of the tab control and the subform on that control
3. If you are using tabbed documents display, try swopping to overlapping windows (though both should work fine

Remember also that my resizing code works best with forms that were originally designed to be used with it.

I'm out most of today but can I also suggest you re-read the following sections on my website article:
a) Possible Issues and Solutions - page 2 of article: http://www.mendipdatasystems.co.uk/automatic-form-resizing-2/4594565280
b) How the Code works - page 3 of article: http://www.mendipdatasystems.co.uk/automatic-form-resizing-3/4594565398

Good luck
 

Gismo

Registered User.
Local time
Tomorrow, 01:12
Joined
Jun 12, 2017
Messages
1,298
yes, i am using a tab control
i only loaded the resize me to he subform itself, not the main form holding the tab control

will resize me override any other form settings such as anchor?
 

isladogs

MVP / VIP
Local time
Today, 23:12
Joined
Jan 14, 2017
Messages
18,186
Why are you resizing the subform rather than the main form?

I would expect that both resizing & anchoring code would both apply...though not necessarily in a good way.
I never use anchoring as I find its effects are clunky & can be unpredictable.
See my comments about this feature on page 1 of my article.
My strong advice is to disable anchoring if you are using automatic form resizing.

Suggest you make a copy of the form without anchoring. See what happens with resizing the subform only.
Then try resizing code on the main form ONLY then on both form & subform.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:12
Joined
Feb 19, 2002
Messages
42,977
I've used Peter's ShrinkerStretcher and I like it a whole lot better than the kludge that was added to Access. Buy a site license if you need to use it in multiple applications.

 

vhung

Member
Local time
Today, 16:12
Joined
Jul 8, 2020
Messages
235
"a tab control"
i only loaded the resize me to he subform itself, not the main form holding the tab control

will resize me override any other form settings such as anchor?
that's right
>anchor left/right or top/bottom is very applicable
>there is codes for that try to search
>i forgot where i place/use the code for anchor a form before
 

Users who are viewing this thread

Top Bottom