Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Modulo Function that allow decimal

Posted on 2001-06-11
4
Medium Priority
?
1,791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 200 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

715 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