sorting a report by days of week

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report that lists class schedule. It first needs to be sorted by
days of week. Unfortunately, the data dump that provides the courses for the
database, uses M T W U F for the days of the week. So when I sort on that
field, I get all the Friday Courses first, instead of all the Monday courses,
etc.

Any suggestions on how to do this?
 
I have a report that lists class schedule. It first needs to be sorted by
days of week. Unfortunately, the data dump that provides the courses for the
database, uses M T W U F for the days of the week. So when I sort on that
field, I get all the Friday Courses first, instead of all the Monday courses,
etc.

Any suggestions on how to do this?

Create a new Module:
Function GetSort(FieldIn as string) as Integer
Dim AValue as Integer
SelectCase FieldIn
Case "M"
AValue = 1
Case "T"
AValue = 2
Case "W"
AValue = 3
Case "U"
AValue = 4
Case "F"
AValue = 5
End Select
GetSort = AValue
End Function

Create a query that will become the record source for the report.
Include all the fields, and add a new column.
SortThis:GetSort([YourDayFieldName])

In the Report Sorting and Grouping dialog, use this SortField as the
sort order.
 
Back
Top