Results 1 to 6 of 6
  1. #1
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53

    Seniority List Query with Two Date Fields


    I made a basic Seniority List for my work place using a simple query that pulls info from a main Employee Table. Easy enough using just a simple query with a sort. Problem is, about a dozen or so of the Employee have left and since been rehired. Their Seniority is based on their Rehire Date and not their Original Hire Date. In the main Employee Table I am pulling this info from, there are two Date Fields...

    [Hire Date]

    [Rehire Date]

    Is there a way to build a query where it can check both fields, use the more recent date, then copy the "winner" in a 3rd field? Am I approaching it all wrong? Is there an easier simpler way to do that?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Dont use a 3rd date field, create a UseDate fld using an IIF : IIF(Isnull([Rehire Date]) or [Rehire Date]>[Hire Date],[Hire Date],[Rehire Date]) as UseDate

  3. #3
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Sorry, I'm a little confused as to how to use that code? Should that go in a new query field?

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Create a query based on your table. Type in this formula in a new field:

    SeniorityDate: Iif(isnull([Rehire Date]), [Hire Date], [Rehire Date])

    This assumes the rehire date is always going to be larger (more recent) than the hire date

  5. #5
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Yup, that did exactly what I wanted it to do. Saves me a bunch of time, thank you!

  6. #6
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Only a question of interest: how do you handle someone, who left twice and was therefor rehired 3 times?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 12-12-2013, 12:14 PM
  2. Query list of clients in date range
    By scorpiogray in forum Queries
    Replies: 2
    Last Post: 05-20-2013, 01:34 PM
  3. Replies: 0
    Last Post: 01-17-2013, 07:43 AM
  4. Replies: 1
    Last Post: 11-08-2012, 02:55 PM
  5. Replies: 12
    Last Post: 05-07-2012, 12:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums