Help Needed With Format Of Query Expression

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne

    Help Needed With Format Of Query Expression

    I'm using the following expression in the query grid to show the Month
    and Year of the date field "TxtDate":

    Week: Format([TxtDate],"ww yy",4)

    I am grouping the results on this field.

    Is there a different way that it can be formatted so that when I sort
    the field it will sort by Week and Year e.g.

    01 07
    02 07
    03 07

    At the moment it is sorting as a text field:

    01 07
    10 07
    11 07

    I can't simply sort by the "TxtDate" field because it isn't part of an
    aggregate function and if I Group on TxtDate or use Min or Max the
    query gives undesired results.
  • Wayne

    #2
    Re: Help Needed With Format Of Query Expression

    On Apr 30, 3:40 pm, "Larry Linson" <boun...@localh ost.notwrote:
    Format yields a text field.  If you obtain the week and year via formatting,
    they will BE text and sort as text.  You can convert them to numeric with
    the CInt or Val function, or you can calculate them instead of using the
    Format statement/function to obtain them. I suspect the former will be
    simpler than the latter.
    >
     Larry Linson
     Microsoft Office Access MVP
    Thanks Larry.

    Comment

    Working...