none
How to hide a row of controls when data is shown? RRS feed

  • Question

  • I have a report with 3 headers.  If header 1 is displayed, I would like headers 2 and 3 to hide/not display/format text as white.  Please help.
    Friday, May 4, 2018 6:57 PM

All replies

  • I have a report with 3 headers.  If header 1 is displayed, I would like headers 2 and 3 to hide/not display/format text as white.  Please help.
    Friday, May 4, 2018 6:58 PM
  • Hi,

    I suppose you want header 1 to hide if header 2 is displayed, correct? If so, how is header 1 gets displayed or hidden? Is it done automatically, somehow, or do you have a button for the user to click? If so, what is the code behind it?

    Friday, May 4, 2018 11:57 PM
  • Hi,

    This thread looks familiar. Can you give us more information? Thanks.

    Saturday, May 5, 2018 12:01 AM
  • Are the headers for three separate group levels, or do you mean three instances of the same group header?  Whichever is the case the solution would be similar:

    1.  Declare a module level Boolean variable, blnCancelHeader say, in the report's module's Declaratons area.

    2.  Assign a value of TRUE to the variable in the header's Format event procedure if the header displays data.  You'll need code in the event procedure to determine whether this is the case or not of course.

    3.  If you are referring to three instances of the same header, then cancel the header if the Boolean variable's value is TRUE.  The code for this must be before that which assigns a value to the variable in 2 above:

        Cancel = blnCancelHeader

    4.  If you are referring to three separate group levels, then, instead of 3 above, put the same code in the Format event procedure of each of the second and third group headers' Format event procedures.

    If you are unfamiliar with entering code into a form's, report's, report section's  or control's event procedures, this is how it's done in form or report design view:

    1.  Select the form, report, section or control as appropriate and open its properties sheet if it's not already open.

    2.  Select the relevant event property and select the 'build' button (the one on the right with 3 dots).

    3.  Select Code Builder in the dialogue and click OK.  This step won't be necessary if you've set up Access to use event procedures by default.

    4.  The VBA editor window will open at the event procedure with the first and last lines already in place.  Enter or paste in the code as new line(s) between these.



    Ken Sheridan, Stafford, England

    Saturday, May 5, 2018 12:24 PM
  • Hello RoxanneSerrao,

    Does anyone's suggestion work for your? Please feel free to let us know the current state of your issue.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 17, 2018 3:12 AM