473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MOD Operation

Why does MsgBox 4.25 MOD 1 display 0? I was hoping to get .25.

Thanks!

Mark
Nov 13 '05 #1
4 2702
Hi, Mark.

Modulus division only returns whole numbers, not fractions.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.
"Mark" <mm*****@earthlink.net> wrote in message
news:7Q*******************@newsread3.news.atl.eart hlink.net...
Why does MsgBox 4.25 MOD 1 display 0? I was hoping to get .25.

Thanks!

Mark

Nov 13 '05 #2
"Mark" wrote
Why does MsgBox 4.25 MOD 1
display 0? I was hoping to get .25.


When you round 4.25 to an integer, you get 4. When you divide 4 by 1 you get
a result of 4 and a remainder of 0. That's why you get 0.

From Access 2003 (Visual Basic 6.3) Help (and the definition of Mod hasn't
changed since Access 1.0, AFAIK):

"Remarks
The modulus, or remainder, operator divides number1 by number2 (rounding
floating-point numbers to integers) and returns only the remainder as
result. For example, in the following expression, A (result) equals 5.
A = 19 Mod 6.7"
Nov 13 '05 #3
If you want to show the "fractional part", you could try

4.25 - Int(4.25)

Larry Linson
Microsoft Access MVP

"Mark" <mm*****@earthlink.net> wrote in message
news:7Q*******************@newsread3.news.atl.eart hlink.net...
Why does MsgBox 4.25 MOD 1 display 0? I was hoping to get .25.

Thanks!

Mark

Nov 13 '05 #4
Hi Mark,

After having read all of these replies, I thought "OK .. try this..."

Dim MyValue as Long
MyValue = 4.25

Dim MyNumber As Long
MyNumber = (MyValue * 100)

Dim MyRemainder as Long
MyRemainder = (MyNumber MOD 100) / 100

--
HTH,
Don
=============================
E-Mail (if you must) My*****@Telus.net

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code samples are also Access97- based
unless otherwise noted.

================================================== ==========================
====
I was "anally raped" on a Timeshare deal by Club All Seasons
http://worf.usshurdman.com/~calgary/...id=26180&code=
, Les Volieres du Quebec, and Club Privilege.

In appreciation for that, please feel free to forward SPAM and VIRUSES to:
ch**********@bellnet.ca
ip*****@hotmail.com
in**@volieres.com

Don't get mad --- get even! :-)
================================================== ==========================
====


"Mark" <mm*****@earthlink.net> wrote in message
news:7Q*******************@newsread3.news.atl.eart hlink.net...
Why does MsgBox 4.25 MOD 1 display 0? I was hoping to get .25.

Thanks!

Mark

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marcus | last post by:
Hi I have a very complex sql query and a explain plan. I found there is a full table scan in ID=9 9 8 TABLE ACCESS (FULL) OF 'F_LOTTXNHIST' (Cost=84573 Card=185892...
4
by: Hardy Wang | last post by:
Hi, I have a win form application, when a button is clicked, a lengthy operation will be triggered. During the time program is still running, this application seems not to be able to response to...
0
by: John Jenkins | last post by:
Hi, any help on this would be greatly apprciated. I have been given a wsdl file from a customer generated by Oracle 10g Web Services tools. When I use wsdl.exe to attempt to produce proxy classes I...
1
by: Laurent Lequenne | last post by:
Hello There, I just converted a VS 2003 C++ Project into VS 2005. I already made some changes in my headers files, has I had compilations errors with enums declarations. Now everything compiles...
0
by: relaxedrob | last post by:
Hi All, I have a portType such as this: <portType name="CMLeJobSoapGetEmpBrand"> <operation name="EJobGetEmpBrand"> <input message="tns:EJobEmpBrdReq" name="EJobEmpBrdReq"/> <output...
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
6
by: Cerebrus99 | last post by:
Hi all, I'm making a Windows application that does some lengthy retrieval operations from a database and possibly from a internet resource. I want to show that the operation is going on, by...
3
by: JuHui | last post by:
I wrote a script to get 100 pages from a server. like below: 1:import httplib 2:conns = httplib.HTTPConnection("www.mytest.com") 3:conn.request("GET", "/") sometimes a socket error was...
2
by: Robinson | last post by:
I can start an Asynchronous operation against a data source with SQLCommand.BeginExecuteReader, allowing me to loop, checking for user cancellation before the operation has completed, but how then...
0
by: Default User | last post by:
I work on creating test cases for a SOAP-based set of servers, using soapUI. I received and updated set of WSDL and schema files, and when I made new tests and mock server operations, all of the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.