IIF statement in Form of Access 2007

Adeola

New member
Local time
Today, 10:29
Joined
Nov 9, 2013
Messages
9
Hello
I have created a form with the fields of the table and i am calculating the EarnedSalary and EarnedAllowance based on the workingDays.Its working fine if i enter workingDays any value.
Now my Question is If an employee is not present for the whole month then Working Days=0 and the final Value of the Gross Salary and Total Deductions should be populated to 0.But i am getting a value in this because of the fixed HRA and transport .Now i want to make GrossSalary and Total Deductions to 0 if WorkingDays=0.
How can i write an IIF statement and where i should wirte ?
Can anybody please help me out.....
 
Without actually seeing the Formula it might be tricky, but it should be something like..
Code:
GrossPay: IIf(WorkingDays = 0, 0, [HRA]+[Transportaion])
 
I have GrossPay field on the Form and calaculating it as
GrossPay=[Earned Salary]+[Earned SPL]+[HRA]+[Transport]+[OT] from the control source

I am getting EarnedSalary from the calcualtion of EarnedSalary=BasicPay/TotalWorkingDays*ActualWorkingDays.

When ActualWorkingDays is 0 then EarnedSalary is 0 .Its populating 0 ok.

Now i want Even My GrossPay also to be 0 But its adding the Values of HRA,Transport where HRA and TRansport is fixed for every month and we cant change the value of them.So how can i make GrossPay to 0 and which event i should write it.
 
Is this in a Query? If so try..
Code:
GrossPay: IIF([Earned Salary] = 0, 0, [Earned Salary]+[Earned SPL]+[HRA]+[Transport]+[OT])
 
its not in a Query it should be displayed on the Form.
 
The same would go for a Form.. Set the control Source..
Code:
= IIF([Earned Salary] = 0, 0, [Earned Salary]+[Earned SPL]+[HRA]+[Transport]+[OT])
 
I am trying to Write it in the WorkDays Field Control Source but its not showing anything.Or should i write it in any Event. As i Already have the calcualtion in the EarnedSalary and GrossPay fileds control Source i amwriting it in the WorkFields.

I am very sorry to disturb u with many questions as i am new to this Access.
 
Okay is the Form Bound/Unbound? If it is bound, is it to a Query or Table? If it is a Query, show the SQL Query..
 

Users who are viewing this thread

Back
Top Bottom