Works: Sorting by Month or Day in Date Field (77002)



The information in this article applies to:

  • Microsoft Works 2.0
  • Microsoft Works 2.0a
  • Microsoft Works 3.0
  • Microsoft Works 3.0a
  • Microsoft Works 3.0b
  • Microsoft Works 4.5
  • Microsoft Works 4.5a
  • Microsoft Works for Windows 95, version 4.0
  • Microsoft Works for Windows 95, version 4.0 4.0a

This article was previously published under Q77002

SYMPTOMS

When data is entered in the Works Database in date format and the field is formatted as a date field, you can sort based on the entire date entered. However, you cannot sort solely by month or day.

For example, if you have several entries for January, you cannot sort by month to have all the January dates appear together, followed by February's dates, and so on.

RESOLUTION

You can work around this limitation by doing the following:

  1. Insert a field next to the date field by clicking Insert Record/Field from the Edit menu. Name the field "Month" or "Day" using the Edit Name command. With Works for Windows 95, click Insert Field from the Record menu and name the field in the dialog box.
  2. In the Month field, enter the formula =MONTH(Date), where (Date) is the name of the field containing the complete date. For example, the following formula returns only the month from the date field:

    =MONTH('7/5/92')

    To sort by day, enter the formula =DAY(Date), where (Date) is the name of the field containing the complete date. For example, the following formula returns only the day from the date field:

    =DAY('7/5/92')

  3. From the Record menu (Works 4.0, 4.5 and 4.5a for Windows 95), Tools menu (Works 3.0), or Select menu (Works 2.0), click Sort Records to sort on the field named Month.

Modification Type:MajorLast Reviewed:11/15/2004
Keywords:kbprb KB77002