Equivalent of Mod function in Access

V

Vadhimoo

Dear All,

We have millions of records in our Access database. For doing calculation, I
need to find out the modular value by 10. Is there any built in function
available in Ms Access as like MOD in Excel? Or how can I get the result from
access or please let me know the query.

For Example:

Number Output
1005.6 5.6
42.3 2.3
147 7

Thanks and Regards,
VAdhimoo
 
T

Tom van Stiphout

On Wed, 25 Mar 2009 06:21:10 -0700, Vadhimoo

The Mod function is also available in Access/VBA, but it works
differently from the one in Excel:
1005.6 mod 10 = 6
If you want the Excel version, you will have to write your own Public
Function in a standard module, and call it from your query:
select myModReplacement(myColumnName, 10)
from myTable
(replace myObjectNames with yours)

-Tom.
Microsoft Access MVP
 
M

Marshall Barton

Vadhimoo said:
Dear All,

We have millions of records in our Access database. For doing calculation, I
need to find out the modular value by 10. Is there any built in function
available in Ms Access as like MOD in Excel? Or how can I get the result from
access or please let me know the query.

For Example:

Number Output
1005.6 5.6
42.3 2.3
147 7


Access VBA has the Mod operator (e.g. 147 Mod 10 is 7), but
it only works with integer values so it won't do all that
you want.

You can use this simple expression to get what you want:

Num - Fix(Num/10)*10
 

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