Show-Hide Report Details linked to group header (1 Viewer)

bax.schwepo

New member
Local time
Today, 05:02
Joined
Nov 6, 2015
Messages
2
Dear all,

I want to show / hide dynamically the detail section in a report. When I have a click event in the group header, just the belonging detail section is showing, not all.

I already tried with the events onpaint, format, current and so on, but nothing worked out.

Has anybody a solution?

Thanks in advance

Bax Schwepo
 

llkhoutx

Registered User.
Local time
Today, 07:02
Joined
Feb 26, 2001
Messages
4,018
Use the report OnFormat event, not the detail OnFormat event, to hide or show the detail section.
 

smig

Registered User.
Local time
Today, 14:02
Joined
Nov 25, 2009
Messages
2,209
A click event on report ?
Don't thint it will ever work
 

llkhoutx

Registered User.
Local time
Today, 07:02
Joined
Feb 26, 2001
Messages
4,018
There is no click events on Reports. Look at the Report, Header, Detail, and Footer event properties.
 

bax.schwepo

New member
Local time
Today, 05:02
Joined
Nov 6, 2015
Messages
2
Hi and thanks for the answers,

there is a click event on the group header and the detail section of the report (single and double click). I am able to show/hide all detail sections of the report by clicking.

But I don't find the "onFormat" event for the report, there is just the section.onformat event for the detail and header section. What is my mistake? Might this be a version problem?

Any suggestions?

Thanks a lot

Bernd
 

MaxGyver

New member
Local time
Today, 05:02
Joined
Aug 19, 2016
Messages
2
Hi,

I am stuck at a very similar problem right now. I basically want to do the same thing:

I have a report with headers and detail sections. Now I want to hide all detail sections when the report is loaded. When I click on a header I want that detailsection to appear and to disappear again when you click again.

So far I have set the click event of the header to the following Makro:

Code:
Private Sub Gruppenkopf0_Click()
   If (Me.Detailbereich.Visible = True) Then
      Me.Detailbereich.Visible = False
   Else
      Me.Detailbereich.Visible = True
   End If  
End Sub

(Note I am using the german version of Access so "Gruppenkopf0_Click()" is the group header click event and "Me.Detailbereich.Visible" is the german of "Me.Detail.Visible". As well ignore the dots on the beginning of each line. Those are so it is easier to read)

This code however only shows and hides all detail sections at once, not only the one belonging to that header. Maybe with the hint on using the VBA Macros someone has an Idea on how to solve this problem?

I am using Access 2013 btw.

I didn't want to open a new thread on this already existing problem so I "heated this thread up" again in hope we can find a solution now.

Best regards,
Max
 
Last edited:

llkhoutx

Registered User.
Local time
Today, 07:02
Joined
Feb 26, 2001
Messages
4,018
Once a report is opened it cannot be modified. The only time a report can be modified is on the "OnFormat" event, that is, when it is being formatted (built). Buttons don't work on reports.
 

MaxGyver

New member
Local time
Today, 05:02
Joined
Aug 19, 2016
Messages
2
Hi,

I don't actually "change" anything in the report, I just set sections to visible = TRUE or visible = FALSE. I use the onClick procedure in the section header. That works but atm I am only able to show or hide the detail sections of all datasets in the report at once due to the lack of referencing the section exactly. I have changed the code slightly now (It is now a bit more universal) but still get the same results:

Code:
Private Sub Gruppenkopf0_Click()
    
    If (Me.Section(acDetail).Visible = True) Then
        Me.Section(acDetail).Visible = False
    Else
        Me.Section(acDetail).Visible = True
    End If
    
End Sub

When I load the report and click on one of the group headers it hides all detail sections - that works so far. But I want it to hide just the detail section of that specific dataset.

The group header and the detail section must be linked someway and I am pretty sure there must be a way to represent that link in VBA code but I haven't figured out how that connection works.

I have also tried the "Recordset"-Property of "Me" but that gives me an error which states it is only available in ADP. Because ADP is not available in the report that won't help the link...
 
Last edited:

llkhoutx

Registered User.
Local time
Today, 07:02
Joined
Feb 26, 2001
Messages
4,018
I repeat, once the report is created it cannot be changed. Hiding or displaying something is a change.
 

Simon_MT

Registered User.
Local time
Today, 12:02
Joined
Feb 26, 2007
Messages
2,177
Perhaps you could try a different approach. Forms? Have one form display at the Grouping level and another at the Detail. On the Header have two Command Buttons - one for Detail Form and another Detail Report. This way you can drill-down on each Grouping Level.

Simon

Simon
 

Users who are viewing this thread

Top Bottom