Date difference calculation in Access

Good day?
I am an intern at a transportation company and I need to create a DBMS (SGBDR) to manage drivers' payrolls (with bonus, vacations...). To calculate seniority, I ran into a (first) difficulty. I think we should compute the difference between the hire date and today's date. The problem is that in the query I can't find the syntax. Anybody can help me, please? Thanks in advance. Mika_gengen. I will be back!

13 answers

  • Votes
  • Date
  • Descending date
  1. try with DiffDate("a";date();hire date) in a form. With date() which is today's date and hire date which is the value of the field you retrieve from your form. It should work normally
    1. Thanks for the help

      mmmba here is some good ham on the bone
    2. Hello

      All my date-related queries are not working.
      My system is in French Canada.

      Some formulas like:
      Tenure: DiffDate("aaaa";[DateEmbauche];Date())
      MembershipYear: PartDate("aaaa";[Date_adhésion])

      That gives me #Error

      Thanks for giving me a hand
    3. @MCLA dumb question: Are your fields actually of type Date/Time????
      --
      Why make life hard by making it simple, when it's so easy to make it complicated?
    4. @LatelyGeekHello

      Yes my fields are of type Date/Time
      My system is in French (Canada)

      I tried by setting my system to English
      and replacing the aaaa with yyyy and that works
      but I can't leave my system in English because
      of all my other Word documents (auto date)

      Thank you
    5. @MariecWell, even though I don’t see the connection with your date format, you can try this:
      Ent((Date()-[Date adhésion])/365) for tenure
      Format([Date adhésion];"yyyy") for the year of joining
      --
      Why make life harder than it needs to be when it’s so simple to make it complicated?