Solved

Modulo Function that allow decimal

Posted on 2001-06-11
4
1,684 Views
Last Modified: 2008-03-06
In VBA the function modulo round decimals before carrying out calculation. I seek a function which won't round the decimal before carrying out the modulo.
0
Comment
Question by:Pomme
4 Comments
 
LVL 7

Expert Comment

by:lmerrell
ID: 6178006
Pomme,


I'm guessing you need to declare your arguments and/or any variables used in the function as Double instead of Integer.  I could tell you for sure if you post the Function here.


lmerrell
0
 

Author Comment

by:Pomme
ID: 6178468
MODULO or MOD is a build in access function you can find it in the help...under MOD
0
 
LVL 8

Expert Comment

by:DennisBorg
ID: 6178529
Pomme:

MOD is an operator which works only with Integer numeric types; which is why it will round any Real numbers before performing the MODULO operation.

I am not certain exactly what you are seeking. Are you wanting to *truncate* the fractional part of the numbers and then perform the MODULO operation?

At any rate, you will need to write your own custom function to accomplish what you desire.

-Dennis Borg
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 50 total points
ID: 6178740
Multiply the numbers by 10 rasied to the x power where x represents the number of decimals that you might have.  Then perform the mod.

Jim.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question