Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What does this expression mean? (Office 2000)

    Hi,
    I have this listed in the "control source" of a text box: "=Format$(Now()-[HIREDATE],"yy",0,0)"

    The result is supposed to be the difference between now and the hiredate. What does the "Format$" mean? I tried looking in help but it didn't recognize it. Also, the "yy,0,0," ?

    The reason why I'm looking at it is because if anyone was hired during the year 1998, the returning result is 7 years. If the hire year is 1999, it also returns the result of 7 years. I'm trying to figure out why based on the above formula. I obviously recognize the "now" and the "hiredate" but I don't know what the rest means.

    Thanks!
    Louise

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

    Re: What does this expression mean? (Office 2000)

    Format$ is the same as the Format function, with the difference that Format$ always returns a string, while Format is a variant that could return Null. Format$ is not the ideal function, since it returns a string, while you want a number.

    It is better to use DateDiff instead:

    =DateDiff("yyyy",[HireDate],Date())

    DateDiff returns the difference between two dates in the unit specified in the first argument. "yyyy" specifies the number of years.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: What does this expression mean? (Office 2000)

    Thanks Hans,
    That does work better!
    Louise

Posting Permissions

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