comparing data

  • Thread starter Thread starter Annelie
  • Start date Start date
A

Annelie

I am trying to test if a rate paid equals the prevailing payrate.
For example:
The RegRate is 27.84, the prevailing rate is 20.44 and 7.40 for a total of
27.84. No fractions involved.

My iif statement: RegRateError: IIf([regrate]<[PrevailingregRate],"Rate is
too Small",IIf([regrate]>=[PrevailingregRate],"ok"))

It will return a "Rate is too Small" for one of the listed items, even if
the rates are the same.
Help,
Anne
 
They may appear the same, when printed with two digits after the decimal
dot, but may differ, say, at the 11th digit after the decimal dot, and if
you use floating point number (instead of decimal data type), that may well
be the case.


You can try (with floating point number):

iif( regrate < (prevalingRegRate - 1E-5), "Rate is too small", "ok" )


Note that the inner iif, in the statement you posted, was having only TWO
arguments (iif requires 3 arguments, not 2), and was a useless test, here,
if regrate and prevailingRegRate were the only values involved in your real
case.




Vanderghast, Access MVP
 
Back
Top