Query to find integer

C

chris

All,

I have two fields A & B. I want a query to output a
record if A/B is not an interger value. Does anyone know
how to do this?

TIA
Chris
 
D

Dale Fye

The MOD operator takes two values and returns the remainder of the
first divided by the second. So, if you then compare that value to 0
you will know whether B is a factor of A. Put the following in one of
the columns of your query grid. If it is a factor, the value will
be -1(True), otherwise 0 (False).

Factor:(A MOD B) = 0

--
HTH

Dale Fye


All,

I have two fields A & B. I want a query to output a
record if A/B is not an interger value. Does anyone know
how to do this?

TIA
Chris
 
J

John Spencer (MVP)

That works ASSUMING that A and B are integers. For numbers with decimal portions
I think I would try:

IntegerValue: A/B = CLng(A/B)

That should return true or false, also. But floating point numbers will be
problematic depending on the degree of accuracy you require. So the following
might be more accurate (or less)

IntegerValue: Abs(A/B - CLng(A/B)) <= .0000000001
 

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