Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    The following command is retruning 3, I need it to return 03

    Thanks, John

    Me.strYearFrom = Format(Date, "yy") - 1 ' 03

  2. #2
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    I tryed: Me.strYearFrom = Format(DateSerial(2004 - 1, 3 - 1, 1 - 1), "yy")

    It returned 03, but I'm not sure of the gotchas with this. Those more in the know will have to comment.

    You could also try: Me.strYearFrom = Right(DatePart("yyyy", Now()) - 1, 2)

    Anyone?

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

    Re: Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Try

    Me.strYearFrom = Format(DateAdd("yyyy", -1, Date), "yy")

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    How about using the Year() function something like:
    <font color=blue><font face="Georgia">
    Me.strYearFrom = Right(Year(Date)-1,2)
    </font color=blue></font face=georgia>
    Wendell

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    They all worked

    Thank you

Posting Permissions

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