Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    New Jersey, USA
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    datepart (97 sr 2)

    When using datepart to pull a month out of a date I am getting a 1 digit date. This is causing a problem with sorting . Is there a way to get a 2 digit month to show or is there any other way to sort using datepart.

    Thanks for your help

  2. #2
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    New Jersey, USA
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datepart (97 sr 2)

    I forgot to add that we are using group by in the query. We think the group by is the cause of the problem.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: datepart (97 sr 2)

    I don't see why it should cause a problem with sorting - the result is numeric unless you force it to be text, so it should sort 1, 2, 3, ..., 9, 10, 11, 12.

    If you want a two digit month number as text, you can use Format([DateField],"mm")

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: datepart (97 sr 2)

    <img src=/S/doh.gif border=0 alt=doh width=15 height=15> Move the datepart to the left of the group by fields in the query grid, so that it will come higher in the sorting hierarchy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •