comparing data

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
 
V

vanderghast

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top