Results 1 to 2 of 2
  1. #1
    SmogelpoT is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2020
    Posts
    1

    Post How to control the viability field of a subreport within a subreport

    Hello everyone first post here!

    Now that's out of the way, down to business. By solving one problem I have created another, over and over and over again.

    Overview:
    I have a report that contains 19 subreports. The main report uses a onload macro that checks a text box value and either makes a specific subreport visible or not. There are ~15 of those checks and associated text boxes that control the visibility of the 19 subreports. My expressions look like



    ...
    If (Me.Q2V.Value = 1) Then
    rptsub_R07.Visible = True
    End If
    ...

    Original Problem:
    The last line on each page of the report was getting cut in half horizontally. As in the top half of the word was on the bottom of one page and the lower half of the word was on the next page.

    First Fix:
    To fix that problem I put each subreport in a group with the group expression being "=1" or some other arbitrary number. Then the keep together function would not allow my words to get split in half. That would have been the end and my report would have been beautiful and all the functions would have worked. Except I could only have a maximum of 10 groups.

    Second Fix:
    To get around that problem I created two additional subreports that had their own groups and subreports, subreport 6 through 13 and subreport 14 through 18, to spread the load and allow me to keep using the keep together functions. However this broke my visibility macro and now the subreports within the subreports don't become visible when required. It's all or nothing, visible or not. The subreports that don't have subreports are still working as expected.

    The Question:
    How can I use the main reports onload macro to control the visibility field of a subreport within a subreport? If I can't keep using the onload macro then that is fine, I just need another solution.

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Welcome to the forums!

    I rarely do sub reports within subreports so I'm not sure I can visualize your problem. What is a "Keep together function"?
    Very often the term Macro is used both for vba code and embedded macros. Judging from the code you provided I gather you mean code. Not a criticism it just confuses some of us.
    One thing you could do just to shorten code is
    Code:
    rptsub_R07.Visible = Me.Q2V
    A checkbox is either true or false so the same if/then statement you have can be written as above.

    We would probably need to see your code or a sample db to give any kind of a focused answer.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 02-13-2024, 07:22 AM
  2. Replies: 4
    Last Post: 09-04-2017, 01:41 PM
  3. Replies: 2
    Last Post: 03-09-2015, 01:06 PM
  4. Replies: 1
    Last Post: 04-15-2013, 10:02 AM
  5. Can't control subreport spacing
    By bonnerm in forum Reports
    Replies: 2
    Last Post: 08-11-2012, 04:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums