Sort Order on Reports

  • Thread starter Thread starter Sue
  • Start date Start date
S

Sue

Hi All.

I have a default sort order set in the sorting and
grouping of my report. However, I allow the user to
specify whatever sort they wish based on the fields in
the report using a QBF from with filters and sort options.

I am using VB to set the Orderby and OrderbyOn
properties. This does NOT change the sort order UNLESS I
remove the default sort order from within the report. It
still sorts based on the sorting specified in the report
itself. There are no Groups.

Help!
If Len(Trim(sOrderBy)) > 0 Then
Reports(sTheReport).OrderByOn = True
Reports(sTheReport).OrderBy = sOrderBy
End If
If Len(Trim(sSqlFilter)) > 0 Then
Reports(sTheReport).FilterOn = True
Reports(sTheReport).Filter = sSqlFilter
End If
End If

Thanks in advance for saving what's left of my hair!

Sue
 
Sue said:
I have a default sort order set in the sorting and
grouping of my report. However, I allow the user to
specify whatever sort they wish based on the fields in
the report using a QBF from with filters and sort options.

I am using VB to set the Orderby and OrderbyOn
properties. This does NOT change the sort order UNLESS I
remove the default sort order from within the report. It
still sorts based on the sorting specified in the report
itself. There are no Groups.

Help!
If Len(Trim(sOrderBy)) > 0 Then
Reports(sTheReport).OrderByOn = True
Reports(sTheReport).OrderBy = sOrderBy
End If
If Len(Trim(sSqlFilter)) > 0 Then
Reports(sTheReport).FilterOn = True
Reports(sTheReport).Filter = sSqlFilter
End If
End If


Sorting and Grouping takes precedence over all other ways of
sorting a report. You can skip the OrderBy stuff and reset
the sort field in the report's Open event:

Me.GroupLevel(0).ControlSource = sOrderBy

You can avoid the use of the Filter property by specifying
the filtering expression in the OpenReport method's
WhereCondition argument.
 
Back
Top