L
LeLe
I am trying to create a round up type function to use in an Access 2003
query. Here is what I have so far.
CutLength: Round((Int(([FLength])/[repeat])+0.99)*[repeat])
It works great as long as the Flength/repeat does not result in a whole
number. As long as the division process leaves something after the decimal
point, the function works great. For example if Flength = 108 and repeat =
10, the function correctly rounds up the 10.8 to 11 and then multiplies by
10 to produce 110 or if the Flength = 104, the function will correctly round
the 10.4 up to 11 and return 110.
Here’s the problem. If Flength = 110 and repeat = 10 the function rounds up
to 12 and produces a result of 120 when 110 is the correct answer.
Is there a simple fix? I hope so, this is only part of my final query.
There are also situations where repeat will = 0 which will destroy the math.
Is this where the nz function would help?
Any help is greatly appreciated.
query. Here is what I have so far.
CutLength: Round((Int(([FLength])/[repeat])+0.99)*[repeat])
It works great as long as the Flength/repeat does not result in a whole
number. As long as the division process leaves something after the decimal
point, the function works great. For example if Flength = 108 and repeat =
10, the function correctly rounds up the 10.8 to 11 and then multiplies by
10 to produce 110 or if the Flength = 104, the function will correctly round
the 10.4 up to 11 and return 110.
Here’s the problem. If Flength = 110 and repeat = 10 the function rounds up
to 12 and produces a result of 120 when 110 is the correct answer.
Is there a simple fix? I hope so, this is only part of my final query.
There are also situations where repeat will = 0 which will destroy the math.
Is this where the nz function would help?
Any help is greatly appreciated.