473,884 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MOD Operation

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

Thanks!

Mark
Nov 13 '05 #1
4 2730
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*****@earthl ink.net> wrote in message
news:7Q******** ***********@new sread3.news.atl .earthlink.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*****@earthl ink.net> wrote in message
news:7Q******** ***********@new sread3.news.atl .earthlink.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.n et

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**********@be llnet.ca
ip*****@hotmail .com
in**@volieres.c om

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


"Mark" <mm*****@earthl ink.net> wrote in message
news:7Q******** ***********@new sread3.news.atl .earthlink.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
5908
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 Bytes=7063896) How can I correlate which part of the SQL statement is running on full table scan. Please see below for the code and explain plan SQL Code
4
1974
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 other actions. When I switch to other window, and switch back to my application, all I can see is a white window, it won't refresh itself until operation finishes. If I have some other buttons in the form, it is not possible to show up during...
0
4148
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 get the following error: Error: Unable to import binding 'SubmitMessageSkeletonBinding' from namespace 'http://webservices/SubmitMessageSkeleton.wsdl' Unable to import operation 'SubmitMessage' The element 'http://www.w3.org/2001/XMLSchema:any'...
1
12002
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 and I got errors at the link as shown below. If anyone could help me to get that thing compiled, he's welcome :-))) Thanks,
0
1317
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 message="tns:EJobGetEmpBrdRes" name="EJobGetEmpBrdRes"/> <fault message="tns:Fault" name="Fault"/> </operation>
8
4859
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 I want to raise the ProgressChanged-event to update the DataGridView. It works fine when only one Progresschanged is fired, but at the second, third, fopurth etc it raises everytile a 'Cross-thread operation not valid"-exception on lmy...
6
2865
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 using an Animated .gif in a picture box. Also note that this PictureBox also acts as the button to invoke this lengthy operation. In other words, the user will click the PicBox to start the operation. When clicked, I update the Image property of...
3
16567
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 raised. File "D:\usr\bin\lib\httplib.py", line 627, in connect
2
4813
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 to cancel the SQLCommand if the user wishes to? The "Cancel" method states: ".......... The Cancel method cannot be used to cancel a pending asynchronous operation." The scenario I'm thinking about here concerns a potentially long-running...
0
3144
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 ones that had been working now returned a SOAP fault. The faults look something like: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Body> <soap:Fault> <soap:Code>
0
11170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10769
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10869
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9591
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7985
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3243
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.