Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide the year when it's 0

Status
Not open for further replies.

Reghita

Programmer
Sep 9, 2002
16
AU
I got a field which calculate the year and month of a employee in the company
Eg: 1 Year, 4 Months

but i need to get only the month when the year is 0, so

when : 0 Year, 4 Months
it should appear only 4 Months

so is there any way that i can do this?
 
You should use an IIF statement to set this up:

Syntax:
IIF( expression , True value return, False value return )

After you have evaluated the employees longevity and have the year and months stored in variables let's say then use the following IIF function to display the results in a form control:

vYears = 0
vMonths = 4
me![EmployeeLongevity] = IIF(vYears = 0, vMonths & " months", vYears & " years, " & vMonths & " Months")

Control will display: 4 Months

Hope this helps. Bob Scriver
 
Hi Bob

Thank you for ur help

it works

tx again
Reghita
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top