473,410 Members | 1,937 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,410 software developers and data experts.

Rounding to multiples of 2

Working on a Access query to pay multiples of 2 hours of time worked
by 75. My problem is I'm not sure how to exclude or remove time that
is not a multiple of 2 (round up or down any decimal to nearest whole
number). Any help would be greatly appreciated.

([minutes]/120)*75

Jan 30 '07 #1
3 1617
You could use the following function:

Function Hours2(Minutes) As Integer
Dim temp As Integer
temp = Nz(Minutes, 0)
Dim i As Integer
Dim m As Integer
i = temp \ 120
m = temp Mod 120
If m >= 60 Then i = i + 1
Hours2 = i * 75
End Function
Paste that code into a module and save it. Then, in a query, you
could use:

Pay:Hours2([minutes])
Chris
On Jan 30, 9:21 am, "Stiemied" <msak...@gmail.comwrote:
Working on a Access query to pay multiples of 2 hours of time worked
by 75. My problem is I'm not sure how to exclude or remove time that
is not a multiple of 2 (round up or down any decimal to nearest whole
number). Any help would be greatly appreciated.

([minutes]/120)*75

Jan 30 '07 #2
Stiemied wrote:
>Working on a Access query to pay multiples of 2 hours of time worked
by 75. My problem is I'm not sure how to exclude or remove time that
is not a multiple of 2 (round up or down any decimal to nearest whole
number). Any help would be greatly appreciated.

([minutes]/120)*75

If time worked is a datetime value:

(Int(timevalue*12) /12) * 75

If time worked is the number of minutes:

(minutes \ 120) * 75

--
Marsh
Jan 30 '07 #3
Thank you for the quick answer! It works perfectly

Matt
On Jan 30, 1:00 pm, "chris.nebin...@gmail.com"
<chris.nebin...@gmail.comwrote:
You could use the following function:

Function Hours2(Minutes) As Integer
Dim temp As Integer
temp = Nz(Minutes, 0)
Dim i As Integer
Dim m As Integer
i = temp \ 120
m = temp Mod 120
If m >= 60 Then i = i + 1
Hours2 = i * 75
End Function

Paste that code into a module and save it. Then, in a query, you
could use:

Pay:Hours2([minutes])

Chris

On Jan 30, 9:21 am, "Stiemied" <msak...@gmail.comwrote:
Working on a Access query to pay multiples of 2 hours of time worked
by 75. My problem is I'm not sure how to exclude or remove time that
is not amultipleof 2 (roundup or down any decimal to nearest whole
number). Any help would be greatly appreciated.
([minutes]/120)*75- Hide quoted text -- Show quoted text -
Jan 30 '07 #4

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

Similar topics

2
by: Prabhakar | last post by:
Hi all, I have a function that does some calculations and returns a value.Before i return i need to round it off to it's nearest whole number based on the value in the hundreth position i.e. for...
4
by: spebola | last post by:
I am using vb.net 2003 professional and I get the following results when using the round method: dim Amount as decimal = 180.255 Amount = Amount.Round(Amount, 2) Amount now contains 180.25. ...
8
by: Zorpiedoman | last post by:
Howcome: Dim D as decimal = .5D msgbox d.Round(D, 0) this returns "0" Now when I went to school .5 rounds UP to 1 not DOWN to zero?????!!! Documentation says this, but what the heck are...
11
by: cj | last post by:
Lets assume all calculations are done with decimal data types so things are as precise as possible. When it comes to the final rounding to cut a check to pay dividends for example in VB rounding...
6
by: abcd | last post by:
I am trying to write a rounding function. Rounding to 0.05. e.g. I should get below results 6.125 --6.15 1.699 --1.7 1.1985 --1.20 0.5625 --0.60 Can someone have any sample for...
18
by: jdrott1 | last post by:
i'm trying to round my currency string to end in 9. it's for a pricing application. this is the function i'm using to get the item in currency: FormatCurrency(BoxCost, , , , TriState.True) if...
248
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
20
by: jacob navia | last post by:
Hi "How can I round a number to x decimal places" ? This question keeps appearing. I would propose the following solution #include <float.h> #include <math.h>
3
by: stateemk | last post by:
Hi, I'm probably making this much harder than it needs to be, but I just can't think of how to do this. Each year, a database is created with all employees on it. I need to pull all the employees...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
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,...
0
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...

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.