How to Hide Ole Objects on a Report if they are empty so as not to leave a big gap on

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lindah
    New Member
    • Dec 2012
    • 2

    How to Hide Ole Objects on a Report if they are empty so as not to leave a big gap on

    I have a report that has several ole objects in it attached to several Headings. Some objects may be left empty and I would like to hide them so that there are no big empty gaps on my report. I have used the following instructions, but it doesn't work unless I put the name of every object in the "On Format" line of the details section of my report e.g. =hidenullole([OPPhoto1])+hidenullole([OPPhoto2]) etc
    Is there a way to check through every object on my report and hide the ones missing.
    Instructions I have used: Create a module ->
    Code:
    Option Explicit
    Function HideNullOle (ctl As Control)
       On Error Resume Next
       ctl.visible = Not IsNull (ctl
       If Err = 2427 Then ctl.visible = True
    End Function
    I have also set the CanShrink to Yes in the details section of the report and the instructions say to put =hidenullole([ctl]) in the "On Format" line of the properties.
    I have also added unbound text boxes on the report to overlap the photos etc.

    If you understand what I am getting at, I would really appreciate some help.

    Thanks
    LH
    Last edited by NeoPa; Dec 17 '12, 10:49 PM. Reason: Added mandatory [CODE] tags.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    Hi Linda. Are the gaps vertical or horizontal?

    For horizontal gaps you could write some code that processes through all Controls in the report section and subtracts X units from the .Left property of all controls where .Left is greater than Y. X ==> The amount you want to move things left; Y==> The .Left of the hidden control.

    Likewise, you can balance things towards the centre using similar logic if that suits better visually.

    Vertical gaps are as straightforward if all within the same section. If going across sections then I have far too little information even to think about this.

    Comment

    • Lindah
      New Member
      • Dec 2012
      • 2

      #3
      Thank you NeoPa,
      They are the vertical gaps and I have managed to close the gaps in a very long-winded way using the instructions that I was first given. As you can tell I am not an expert in this but do like to find the answers on this site. So thank you very much.
      LH

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Are these vertical gaps enclosed within a single section (EG. Detail; Group Header; Group Footer)?

        Can you show us what you've got so far. You refer to "instructions you were first given", but I see no explanation of what that might mean (unless to my post #2) so it's not something that means anything to us.

        I'm pleased to hear you find the site helpful. I'd like to be more so, but am a little frustrated by lack of understanding of what I'm trying to help with.

        Comment

        Working...