467,119 Members | 739 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,119 developers. It's quick & easy.

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.
Nov 22 '10 #1
  • viewed: 1374
Share:
1 Reply
TheSmileyCoder
Expert Mod 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. Dim dblH as Double
  2. 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.
Nov 23 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by dkelly925@yahoo.com | last post: by
4 posts views Thread by Yaro | last post: by
2 posts views Thread by rmfoley@oasis.mediatti.net | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.