473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1638
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
9182
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 example if the value is 1042 i need to return 1000 and if the value is 1090 i need to return 1050.System.Math.Round() is not allowing me to do this. Any help in this reagards is widely appreciated. Thanks
4
7834
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. I need it to contain 180.26. Any ideas?
8
2088
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 they thinking??? I just don't
11
6664
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 seems to be done like this 3.435 = 3.44 3.445 = 3.44 Dim decNbr1 As Decimal
6
4709
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 this....Plain C/C++ function will also do. I want to write more of a generic function so that it could be used from C/C++ programs so I will avoid using the C# advanced functions.
18
2237
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 an item is 41.87 i want the application to bring it up to 41.89 if an item is 41.84 i want the application to round down to 41.79 does anyone know how i could do this?
248
1510
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) It then updates the value with numberOfPrecisions after the decimal
20
5023
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
1917
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 from the last five years and delete any duplicates. Each table has the exact same fields. So basically, I'm trying to combine tables from 2005, 2006, 2007, 2008 and 2009. Most of the employees will stay the same from year to year, so by combining...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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
10341
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
10089
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
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...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.