• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1371
  • Last Modified:

How to get height of subreport after it "grows"?

I have a subreport control that can grow or shrink. How do I get the height in VBA after it grows? Thanks!
0
ironpen45
Asked:
ironpen45
  • 6
  • 4
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
From some where in the Main Report:

    Debug.Print Me.rsub1.Report.WindowHeight / 1440

    or

   dim x
   x =  Me.rsub1.Report.WindowHeight / 1440  ' value in inches. Drop 1440 to get in twips

 1
0
 
ironpen45Author Commented:
So if I wanted to resize the height of a surrounding box based on the subreport, what would be the approach?

I'm trying to use Me.boxBorder.Height which seems to be inches, but it doesn't jive proportionally according to my code:
Dim lngHeightSubF As Long, lngHeightBox As Long, lngHeightBoxFinal As Long
    
lngHeightSubF = Me.rptSubJobMessages.Report.WindowHeight
Debug.Print lngHeightSubF
    
lngHeightBoxFinal = lngHeightSubF + (lngHeightSubF * 0.01)
Debug.Print lngHeightBoxFinal
    
Me.boxJobMessages.Height = lngHeightBoxFinal

Open in new window

0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Leaving work ... will have to pick this up later ...

Note conversion FWIW:

1440 twips per inch.

mx
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ironpen45Author Commented:
hi mx any further thoughts?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
oops ... sorry, beyond slammed. Will try to work on this tonight.  Can you ping me later ?

mx
0
 
ironpen45Author Commented:
sure mx. thanks so much!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Actually, can you upload a db with the issue, with instructions ... that would help.
Keep it simple as possible.

thx.mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
When you work with these properties (height, width) ... IF ... you are tagging on some additional value, then you have to use the conversion of 1440 twips per inch.

So, this:

Dim lngHeightSubF As Long, lngHeightBox As Long, lngHeightBoxFinal As Long
   
lngHeightSubF = Me.rptSubJobMessages.Report.WindowHeight
Debug.Print lngHeightSubF
   
lngHeightBoxFinal = lngHeightSubF + (lngHeightSubF * (1440 * 0.01) )
Debug.Print lngHeightBoxFinal
   
Me.boxJobMessages.Height = lngHeightBoxFinal

But, if you were just summing the two heights for example, it would be

lngHeightBoxFinal = lngHeightSubF + (lngHeightSubF   ' no 1440 conversion required.

As soon as you 'add' something to one of the height values,  you need to use the 1440 conversion.

mx
0
 
ironpen45Author Commented:
this worked! thanks for the advice! sorry for taking so long to  respond, just got sidetracked with continuing the project. but it works like charm now.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Excellent.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now