Solved

Modulo Function that allow decimal

Posted on 2001-06-11
4
1,649 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now