How to find a position of a control on report's page?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bdmir
    New Member
    • Jan 2011
    • 20

    How to find a position of a control on report's page?

    Hi All,

    I want to place a promotion message into a report's page if that page has a free/blank space.

    Maybe it would be better to track last control's coordinates on page when page is generated, and then after that control to place a message. But I don't know how to find controls coordinates on page. Any ideas?
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Hi bdmir

    In your details Format event, you can use Me.Top to indicate where your detail STARTS.

    If you need to know where you detail ENDS it depends on whether you have fields that can grow. If you dont its simply a matter of taking the lowest/bottom-most control on your detail (lets say tb_Example) and it would look like:
    Code:
    Dim lngBottom as long
    lngBottom=Me.Top+Me.tb_Example.Top+Me.tb_Example.Height
    Now if you do have controls that can grow, you can use Stephen Lebans fCanGrow code to determine the height of the growing control, and adjust the code accordingly.

    I have used code such as this myself, to determine whether or not to force a pagebreak after a detail.

    Comment

    • bdmir
      New Member
      • Jan 2011
      • 20

      #3
      Thanks for the quick reply. Yes, I do have growing controls. I will try to do something with Me.Top. Found Stephen Lebans fCanGrow, I will try with that one too. Thank you very much.

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        Stephen Lebans CanGrow
        You can still find that code, and alot of other usefull code on his site.

        Comment

        Working...