Calculations

rhay

Registered User.
Local time
Today, 19:35
Joined
Mar 30, 2001
Messages
24
I have a field on my form that displays a calculation based upon the amount in another field.

IE:

[Forms]![Wheels Up]![Passengers]/100+1

What this does is set the value for another field based upon the number inputed into the passengers field.

However what is happenning is if the passengers field is between 101 and 149 it doesn't take it into consideration.

I'll explain what I need this to do:

This calculates the number of trucks I need based on the number of passengers:

If I have 130 passengers, I need 2 trucks, 1 truck for every 100 and any portion of 100. Then the formula above adds 1 additional truck as a spare.

Thanks,

Robert
 
Hi Robert

You need to use the Mod function to see what the remainder is. Try this below ... I think it ought to work, but I haven't actually tested this exact example (though I do use similar calculations).

=IIf(([Forms]![Wheels Up]![Passengers]=0),0,IIf(([Forms]![Wheels Up]![Passengers] Mod 100)=0,([[Forms]![Wheels Up]![Passengers]/100),([[Forms]![Wheels Up]![Passengers]/100)+1))

HTH

Rich Gorvin
 
No, it didn't work, it kept giving me compile errors and I don't know enough about VB to fix it.

Thanks for the help

Robert
 

Users who are viewing this thread

Back
Top Bottom