SteveStew44
Registered User.
- Local time
- Today, 14:21
- Joined
- Nov 13, 2014
- Messages
- 23
Hello WA!
Hope all have been well. How can I change report Sorting and Grouping through code? I tried:
Dim rpt As Report
Dim strReportName As String
strReportName = "ReportName"
DoCmd.OpenReport strReportName, acViewDesign
Set rpt = Reports(strReportName)
rpt.OrderByOn = True
rpt.OrderBy = "Variable1, Variable2"
DoCmd.Close acReport, rpt.name, acSaveYes
DoCmd.OpenReport strReportName, acViewPreview
But this did not work. I assume because it is on the Open command for the report. I think I might have to place some Event Procedure in the Group Header - On Format or On Print? However, I can not find the right syntax to do that.
Thanks in advance for any guidance!
Steve
Hope all have been well. How can I change report Sorting and Grouping through code? I tried:
Dim rpt As Report
Dim strReportName As String
strReportName = "ReportName"
DoCmd.OpenReport strReportName, acViewDesign
Set rpt = Reports(strReportName)
rpt.OrderByOn = True
rpt.OrderBy = "Variable1, Variable2"
DoCmd.Close acReport, rpt.name, acSaveYes
DoCmd.OpenReport strReportName, acViewPreview
But this did not work. I assume because it is on the Open command for the report. I think I might have to place some Event Procedure in the Group Header - On Format or On Print? However, I can not find the right syntax to do that.
Thanks in advance for any guidance!
Steve