MS Access - Dynamically size form based on report size (1 Viewer)

ironfelix717

Registered User.
Local time
Today, 16:45
Joined
Sep 20, 2019
Messages
193
Hi,

I have a form I am trying to dynamically size based on a sub-report. The form opens, a report is loaded into the subform control (this is dynamic, can be any report), the form is sized appropriately to the report. For example, if a 4x6" report is loaded, the form detail is changed to size accordingly. This functionality would be present for any report size...

Typically I could solve this with VBA, but since the report object's size properties are not readable (stupid!) I can not achieve this programmatically.
Is this possible in form design with anchoring / form properties?

Thanks----
 
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 21:45
Joined
Feb 19, 2013
Messages
16,600
the report object's size properties are not readable
yes, they are

use mysubform.report.width for the width

and mysubform.report.section(x).height for the height

x relates to each section (page header, footer, group header, footer, detail etc) - see https://docs.microsoft.com/en-us/office/vba/api/access.report.section

You'll need to multiply each section by the number of iterations of that section in the report
 

Users who are viewing this thread

Top Bottom