calculating years employees have worked for

Ginty

Registered User.
Local time
Today, 23:22
Joined
Jun 3, 2005
Messages
15
hi, i want to calculate how long each person has worked at a company.

i am using access 97.

would i be able to enter something in the criteria that would work this out for me?

something like year([START DATE]) - year(Now())
this does not work but i want to find out the number of years a person has worked for the company from the field START DATE .

thanks for you help.
 
datediff("Y",Date(),[Start_Date])

????


Edit: Sorry, try this:

DateDiff("yyyy",[start_date],Date())
 
Last edited:
NewField: DateDiff("yyyy",[Start Date],Date()) + (Format(Date(),"mmdd")<Format([Start Date],"mmdd"))


Put it in the Field row, not the Criteria row.
The expression will give you the number of complete years.

^
 
Last edited:
the field row in the table ?

i tired to change the totals to expression in the query but i got the error "You tired to execute a query that doesn't include the specified expression 'LENGTH OF SERVICE' as part of an aggregate function"

Have you got any example databases of this expression working that i could view in access 97?
 
I have got that working now...
so by changing the setting i can work out days, months, seconds etc...

LENGTH OF SERVICE: DateDiff("m",[START DATE],Date()) works out months

but would i able to work out the years, months and days?
 
Last edited:
yeah i realised this when i used the code for working out date of births. That is what the rest of the code is for.

i cant seem to get this time elapsed function to work.

i entered this
Elapsed Time: getTimeElapsed([START DATE])

and got an error saying "undefined function 'getTimeElapsed' in expression"

it works in the example database that was attached but not in mine.

thanks for your help
 
Is it because i have not writen the vb function in my database?

i dont have vb on this machine... would i need to install it?

or is there another way of getting the information i require?
 
sorry for being such a pain, i created a module and added the code, it is working fine now.
 

Users who are viewing this thread

Back
Top Bottom