Dim objApp As CRAXDRT.Application
Dim objRep As CRAXDRT.Report
Dim objSubReport As CRAXDRT.Report
Dim objSections As CRAXDRT.Sections
Dim objSection As CRAXDRT.Section
Dim objReportObjects As CRAXDRT.ReportObjects
Dim objSubReportObject As CRAXDRT.SubreportObject
Dim lngIdx As Long
Set objApp = New CRAXDRT.Application
Set objRep = objApp.OpenReport(strReportName)
Set objSections = objRep.Sections
For Each objSection In objSections
Set objReportObjects = objSection.ReportObjects
If objReportObjects.Count > 0 Then
For lngIdx = 1 To objReportObjects.Count
'make sure the report object is a subreport.
If objReportObjects(lngIdx).Kind = crSubreportObject Then
'open the subreport
Set objSubReportObject = objReportObjects(lngIdx)
Set objSubReport = objSubReportObject.OpenSubreport
If objSubReport.GroupSortFields.Count > 0 Then
objSubReport.GroupSortFields(1).SortDirection = lngSortDirection
End If
End If
Next
End If
Next