Hi, I have a textbox with the following code. It works out the unit cost of an operation on an item and displays the correct answer. Given that a process could have several operations to complete, I want to put the final unit cost in the footer of my form.
I have added a textbox with the controlsource set as per the second piece of code.
It, however, doesn't work and I just get #error in the box.
Working Code:
=IIf([Est_Machine_Setup_Time]>0,[Est_Machine_Setup_Time]*[Machine_Setup_Cost_Per]/[quantity],0)+IIf([Est_Machine_Time]>0,[Est_Machine_Time]*[Machine_cost_per]/[quantity],0)+IIf([Est_Resource_Time]>0,[Est_Resource_Time]*[Resource_Cost_Per]/[quantity],0)+IIf([External_Resource_Cost]>0,[External_Resource_Cost]/[quantity],0)
Non-Working code:
=Sum(IIf([Est_Machine_Setup_Time]>0,[Est_Machine_Setup_Time]*[Machine_Setup_Cost_Per]/[quantity],0)+IIf([Est_Machine_Time]>0,[Est_Machine_Time]*[Machine_cost_per]/[quantity],0)+IIf([Est_Resource_Time]>0,[Est_Resource_Time]*[Resource_Cost_Per]/[quantity],0)+IIf([External_Resource_Cost]>0,[External_Resource_Cost]/[quantity],0))
all help appreciated, my thanks in advance.
Regards,
Graham
I have added a textbox with the controlsource set as per the second piece of code.
It, however, doesn't work and I just get #error in the box.
Working Code:
=IIf([Est_Machine_Setup_Time]>0,[Est_Machine_Setup_Time]*[Machine_Setup_Cost_Per]/[quantity],0)+IIf([Est_Machine_Time]>0,[Est_Machine_Time]*[Machine_cost_per]/[quantity],0)+IIf([Est_Resource_Time]>0,[Est_Resource_Time]*[Resource_Cost_Per]/[quantity],0)+IIf([External_Resource_Cost]>0,[External_Resource_Cost]/[quantity],0)
Non-Working code:
=Sum(IIf([Est_Machine_Setup_Time]>0,[Est_Machine_Setup_Time]*[Machine_Setup_Cost_Per]/[quantity],0)+IIf([Est_Machine_Time]>0,[Est_Machine_Time]*[Machine_cost_per]/[quantity],0)+IIf([Est_Resource_Time]>0,[Est_Resource_Time]*[Resource_Cost_Per]/[quantity],0)+IIf([External_Resource_Cost]>0,[External_Resource_Cost]/[quantity],0))
all help appreciated, my thanks in advance.
Regards,
Graham