rkaria
10-18-2010, 05:25 AM
Hi All
I would like to set a command button so that when a user clicks on it, they get an option to show the summary version of the report or a detailed one.
Can anyone advise on how to do this please?
Using Access 2007
Thanks
R
khawar
10-18-2010, 07:29 AM
You can use an option group on the basis of which it can be decided which report to run
rkaria
10-18-2010, 07:53 AM
You can use an option group on the basis of which it can be decided which report to run
Thank you, can you explain in a bit more detail please.
Thanks
R
boblarson
10-18-2010, 10:22 AM
Do you have your details in the details section and the grouping stuff in group headers/footers? If so you can use this to set the detail section to visible or not:
Me.Section("Detail").Visible = False
If you have a checkbox on your form where you open the report from, for example, which is labeled "Show Details" you can just use this in the Report Detail Section's On FORMAT event:
Me.Section("Detail").Visible = Forms!YourFormNameHere.YourCheckBoxNameHere
Simon_MT
10-18-2010, 11:02 AM
I prefer having a Dialog Form that contains StartDate and EndDate Controls with two buttons Detail and Summary. After Opening the Report you hide his Dialog Form and on Closing the Report you Open the Dialog Form so that it reappears.
The reason for this approach is that having looked at the Summary Report there maybe something that requires further investigation so you then run the Detail Report and scrutinise it more thoroughly.
Simon
rkaria
11-01-2010, 03:51 AM
Do you have your details in the details section and the grouping stuff in group headers/footers? If so you can use this to set the detail section to visible or not:
Me.Section("Detail").Visible = False
If you have a checkbox on your form where you open the report from, for example, which is labeled "Show Details" you can just use this in the Report Detail Section's On FORMAT event:
Me.Section("Detail").Visible = Forms!YourFormNameHere.YourCheckBoxNameHere
Thank you I tried with the check box as I think thats the way I want to do it, nothing happens when I click on the command button to open the report now.
I created a check box on the form where you click the command button to open the report called check145.
I went to the report in question properties of the detail section and under the event tab and typed under 'On format' the follwing:
Me.Section("Detail").Visible = Forms!AMKreportframework.check143
It looks like it runs something in the background for a couple of seconds but nothing happens or opens.
Do you know why this could be?
rkaria
11-01-2010, 06:51 AM
Thank you every one for you help, I have found a resolution below is the coding I put on a command button:
Private Sub Command31_Click()
DoCmd.SetWarnings False
If MsgBox("Would you like to see summary version", vbYesNo, "title") = vbYes Then
DoCmd.OpenReport "claimsbypartno/warrantycode-product summary", acViewPreview
Else
DoCmd.OpenReport "claimsbypartno/warrantycode-product", acViewReport
End If
End Sub