What have you tried? I believe there is a command button wizard that writes the code to run a query. You can then modify the code to run additional action queries from the same button. If your "query to group or sum data" is the Record Source of the report, you shouldn't need to do anything with it, just open the report.
Just to expand on Duane's last comment. If the report is what you want then there's no need to run the query because the query will automatically be called when you run the report.
The Command Button wizard will generate this code to open and preview a report:
Code:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
Dim stDocName As String
stDocName = "MyReport"
DoCmd.OpenReport stDocName, acPreview
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click
End Sub
and you can see that it's the DoCmd.OpenReport that does the work. If you want to run several reports then you can add some more lines like this:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.