Results 1 to 12 of 12
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Cool Dynamically Hiding Detail Sections


    OK Gang,

    I am wading into report design now. As with most other things, my knowledge in this area is pretty dusty and dated, meaning Access 2003 dated.

    I have added an extra level of detail to a report that has to levels of grouping. There is not any detail for most groups, but it is throwing in a blank section where there is no detail creating a lot of blank space on the page. How do I get these sections to shrink up in these cases and not take up space on the page. I hoping this is easy, because I have more where this came from.

    Thanks in advance.

    Paul

  2. #2
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    If I succeed with that I have a second, similar problem. I have a sub report I want to show in the footer of group 2. I want it to show in only on category of data. I've just got a placeholder there right now and of course it is showing up everywhere. The logic on this would be.

    Code:
     
    If ReportType = 1 then 
           show subreport
    Else
           Hide subreport
    end if
    Of course I can write real VBA once I know what I am working with.

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I think the title on this should be "Conditionally Hiding Report Sections". In one case I want to hide the detail section when there are no records. I'm not sure why this wouldn't happen automatically.

    In the other case I only want to show the Group Footer if the Report Type = 1.

    I'm hoping to have this ready for a presention soon.

    Thanks,

    Paul

  4. #4
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Still Trying

    I redicovered the Can Shrink and Can Grow properties of text boxes. That solved problem 1.

    I'm still looking to conditionally hide the group footer based on Report type. So far any code I put in the OnFormat event does not execute, but I'm trying to used something like

    Code:
     
    If Me.txtType = 7 then
    Me.GroupFooter1.Visible = True
    Else
    Me.GroupFooter1.Visible = False
    End If
    I can't figure out where to place this code to even test it.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    It would go in the group footer's On Format event and if you want it to not show in Report View as well, it would need to go in the group footer's On Paint event as well.

  6. #6
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Thanks Bob,

    When I place the code in the On Format event of the Group Footer nothing happens. The code does not execute. I placed a msgbox "Hello" in the code to check it. I also placed a break in it. I don't know why, but Access ignores whatever I put in there.

    Code:
     
    Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    If Me.txtType = 7 Then
    Me.GroupFooter1.Visible = True
    Else
    Me.GroupFooter1.Visible = False
    End If
     
    MsgBox "hello"
    End Sub
    Sorry, very frustrated.

    Paul

  7. #7
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Normally if that happens then either corruption is taking place or you need to resynch your VBA code by doing a DECOMPILE.

    Make a copy just in case something happens when you do the Decompile, but then follow the directions here:
    http://www.granite.ab.ca/access/decompile.htm

    If that doesn't help then try importing everything into a brand new database shell.

  8. #8
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Ugg! Won't have time for this for a couple days. I'll let you know.

  9. #9
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    FYI, the section format events do not fire in Report View, if that's how you're opening the report. They only fire in Preview or Print. Still have a flat spot on my head from that one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Gawd, that means each time I tested was .... oh well, I can't wait to get back in and see if my code may actually work. Later today maybe.

    Thanks Paul

    p.s. Stay away from cast iron, it could do some real damage.

  11. #11
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by pbaldy View Post
    FYI, the section format events do not fire in Report View, if that's how you're opening the report. They only fire in Preview or Print. Still have a flat spot on my head from that one.
    Which is why I posted:
    Quote Originally Posted by boblarson
    It would go in the group footer's On Format event and if you want it to not show in Report View as well, it would need to go in the group footer's On Paint event as well.

  12. #12
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    It went right over my head Bob. The code DOES excute in Print Preview, which I hadn't been using. Wish I had figured this out a couple days ago, but I don't think I'll be forgetting it.

    I'll see if I can implement this in a practical way tomorrow and let you know what happens.

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

Similar Threads

  1. Report with Two Detail Sections?
    By beribimba in forum Access
    Replies: 2
    Last Post: 08-30-2011, 03:04 PM
  2. Selecting row sections from a table
    By dmol in forum Access
    Replies: 3
    Last Post: 02-24-2011, 01:21 PM
  3. Personnel Roster with 4 sections
    By tat2z_21 in forum Access
    Replies: 8
    Last Post: 01-20-2011, 04:56 AM
  4. extra detail sections
    By kroenc17 in forum Reports
    Replies: 10
    Last Post: 10-08-2010, 11:35 AM
  5. Multiple Details Sections of report
    By nkuebelbeck in forum Reports
    Replies: 1
    Last Post: 03-17-2010, 09:34 AM

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