How to calculate the size of a subform in an access report?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pepiño

    How to calculate the size of a subform in an access report?

    Hello

    I have an access report which is being populated by a macro dinamically depending on the number of records in the database. The report has a header and a footer (and a subform placed in between)

    Header and footer have a fixed format and height.


    My problem is really that I want to know where my footer is going to sit. Furthermore, inside my footer I designed a box (Rectangle reads the selection type). All I want to know is where this rectangle will lie in the access report. This place will obviously depend on how long my report is

    Thus, in the end, what I need to calculate is the height of the subform in the report.
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Stephen Leban has some code that can estimate the height of a textbox (I.e. what height it will have after its "grown"). You can google him to find it.

    If you use that, you can then calculate the forms height. If it is from within the form/report you can use:
    Code:
    Dim dblH as Double
    dblH=Me.Height-me.tb_Example.Height+fTextHeight(Me.tb_Example)
    This basicly takes the design height of the form/report (Me.Height) and adjusts it by replacing the design height of the textbox (me.tb_Example. Height) with the runtime height of the textbox (fTextHeight(Me .tb_Example)).

    It can be a bit tricky, but I've used code similar to whats described here to predict how large the next record would be, and whether or not it would fit on the page, and based on that info, choosing whether or not to insert a pagebreak.

    Comment

    Working...