Modules & VBA :: Convert Minutes Into Decimal

Jun 28, 2013

I have the following code for hours worked by staff over a 24hr period. However, I want to calculate staff pay by using their hours worked. The table I am using is populated with the minutes i.e. 270 but I want this field to display 3.5 hrs. I have initially got round this by using a calculated field in the table [Hoursworked]/60*[StaffPay] but this is not an ideal fix. Can I add something to the code below to display the hours to 2 decimal places.

Code
Dim ilHoursWorked
ilHoursWorked = IIf(CDate(Me.txtStartTime) < CDate(Me.txtFinishTime), DateDiff("n", CDate(Me.txtStartTime), CDate(Me.txtFinishTime)), 1440 - DateDiff("n", CDate(Me.txtFinishTime), CDate(Me.txtStartTime)))

View Replies


ADVERTISEMENT

Convert Hours & Minutes To Minutes

Jan 22, 2008

How can I convert hours and minutes to minutes as an Integer?

For example, convert 2:15 to 135.

Any help is greatly appreciated.

View 8 Replies View Related

Queries :: Utilization Database - Calculating Hours Minutes From Decimal

Apr 23, 2015

I'm working on a utilization database and pulling Excel data from Cognos 8. I use Access formulas to separate hours and minutes because I want to use time (.30, .45 (minutes)) instead of quarterly increments (.25, .50). I've successfully segregated hours, because I also have to turn days into hours. When I try to calculate out a column just for minutes, my formula keeps the number of days and I don't know how to fix it so the column just shows the minutes.

An example is a job has a decimal time of 2.02083333, which when done correctly is 48 hours and 30 minutes. I get the 48 hours correct, but the minutes shows as 2.30 instead of 0.30. That inflates the total job time to 50.30. This is the calculation currently in my database to pull out minutes:

Minutes: Int(([Min]60)24) & "." & Format([Min] Mod 60,"00").

How do I get rid of the '2' in the 2.30?

Access 2010

View 2 Replies View Related

Convert Time Into Minutes Value

Mar 31, 2008

Hope some one can help I have a field with a time value in it in the format:

08:30 (this is a date/time field) what I would like to do is convert this value in a query to minutes.

Ie.

08:30 (8 hours 30 minutes) convertes to 510 minutes. any pointers. Thanks.

View 1 Replies View Related

Convert Minutes From Number To Time

Mar 30, 2006

Is there any way to take a field that is a whole number and convert that number to appear like a time?

i.e.

120 shows as 2:00
106 shows as 1:46
25 shows as 0:25

View 2 Replies View Related

Time/Decimal Convert

Nov 8, 2007

I have a query with 2 fields I wish to multiply together to get a value for a feild, [Hours_Lost]. One is a short time field and one is a number field. The short time field is [Hours] and the number field is [people] I have been trying the following but no luck. Abnyone any ideas?

Hours_Lost: [People]*(CDbl([Hours])*24)

View 6 Replies View Related

How To Convert Decimal Values To Octal

Mar 28, 2008

Hi,

does anyone know how to convert decimal numbers to octal using a comand in a query , for intance in excel the command is DEC2OCT(val)

Cheers

View 2 Replies View Related

Queries :: Convert Decimal Part Days To Hours

Dec 23, 2014

I have a query result for example = 2.19 days worked. The result of cumulated hours divided by 8 (hours in the workday). What I want to do is take the .19 and multiply it by 8 (hours in the workday) and I would have the result in actual hours which is what I need. Or of course if there is a way to display that into 2 days and 1.52 hours Rounded up to quarters would be even better. But with spending hours looking through forums I didn't find a way to just work with the decimals right of the dot. Trim, format, Len didn't work for me, they all give me funny result.

View 7 Replies View Related

Converting Minutes From A Query To Hours:Minutes On A Report

Jun 12, 2013

Basically I have a table setup where Time Fields are stored. What I need to do is in a Query, have the difference of two Time Fields calculated, and then displayed on a Report. Here's what I have so far...

Table

- Start Time
- End Time

Query

Difference Time: DateDiff("n",[Start Time],[End Time])

All that works fine and shows up on the report, except for the fact that the time is showed in straight minutes, so for a difference of 1:30 minutes, it just shows 90 minutes. I need to make it so that on the report in the Difference Time Text Box, it's showed as 1:30 instead of 90.

I tried putting the following in the Control Source for the Difference Time Text Box on the report, but it returns an error.

=[Difference Time] 60 & Format([Difference Time] Mod 60, ":00")

View 4 Replies View Related

Modules & VBA :: How To Get Login Form To Reappear After 10 Minutes

Mar 12, 2014

If the database sits dormant or unused for 10 minutes the login window needs to reappear for a possible new user.

View 1 Replies View Related

Modules & VBA :: Auto Hit Commandbutton If There Is No Activity For 10 Minutes

May 19, 2015

I have to write piece of code to achieve the following:

1. When the Form gets opened then timer will start.
2. It will fire BtnClose_click event automatically after 10 minutes if there is no activity for 10 minutes.
3. Whenever BtnSave is clicked by the user then reset the timer.

View 2 Replies View Related

Modules & VBA :: 2 Minutes Delay When Code Is Within The Loop

May 15, 2015

I want to make delay, for example 2 minutes when the code is within the loop.

Example

Code:
For i = 0 To 100
Debug.Print i
'Before go to the next to make the delay
Next

View 12 Replies View Related

Modules & VBA :: SendKeys After Every 5 Minutes To Stop Screen Saver To Occur

Mar 3, 2015

I am writing the following piece of code to be called again and again after 30 min. But I need to do invisible mouse move to stop screen saver occurring so i want to sendkeys after every 5 minutes. The Sub abc is in module and everything works except stopping screensaver from occurring.

Code:
Private Sub UserForm_Initialize()
'Update the Barcodes printed today
Call CommandButton1_Click
'Update batches to be scanned / batches scanned today
Call CommandButton3_Click

[Code] ....

View 14 Replies View Related

Modules & VBA :: How To Modify Code To Accommodate Time That Exceed 1440 Minutes

Oct 8, 2014

I have a function that formats minutes to "hh:mm:ss" but its doesnt work if minutes is equal to or greater than 1440 minutes/24 hrs.

Code:
Forms![frmTasksTimer]!estimate_time = FormatTime(Forms![frmTasksTimer]!amount_left, Forms![frmTasksTimer]!Rate)

Code:
Function FormatTime(Amount As Double, Rate As Double) As String
Dim x As String
x = CStr(Round(Amount / Rate * 60))
FormatTime = Format(x / 1440, "hh:mm:ss")
End Function

How can i modify this code to accommodate time that exceed 1440 minutes?

View 9 Replies View Related

Round Up Decimal Point To 4 Decimal Places

Jun 2, 2005

Hi there,

I am not sure the best way to do this,

I have a field with values that look like: 1.69553366385509 or 0.0061705541157596

I want these values to look like: 1.6955 or 0.0062 (4 decimal places [rounded up if possible])

Thanks for your help with this

Sue

View 5 Replies View Related

Modules & VBA :: Round To 2 Decimal Places

Apr 1, 2014

Problem: I want to "round" (to 2 decimal places) numbers 1-5 down and 6-9 up. For example:

1.915 = 1.91
1.916 = 1.92

I know this is completely screwy but I have to match numbers up to a purchasing system that seems to be doing just that.

I've researched rounding in Access a lot and I understand Bankers rounding (that won't work), I understand Int() and Fix() both don't do what I need. I've something about rounding half down (which is what I think I need) or Floor which I don't quite understand.

View 14 Replies View Related

Modules & VBA :: Dynamic Number To Decimal Converter

Feb 20, 2015

I've been looking into writing an access form used for hard drive analysis and came across hex values. This made me start dabbling with numbers again and came up with the following function.If you're a person that enjoys playing with numbers, could I get you to think of any scenarios where I could solidify this function to handle errors and become as dynamic as possible!

I think the end result could be useful to add to this communities quick fix library. What it does is take two strings, value and and the definition of how that numbers counts, and with these two values it will spit out the decimal value.

examples:
HEX - "FFF", "0123456789ABCDEF"
OCT - "777", "01234567"
BINARY - "11111110", "01"

Code:
Public Function ConvertStringToDecimal(ByVal str As String, _
ByVal def As String) As Variant

Dim inc As Integer: inc = Len(def)
Dim n As Variant: n = CDec(0)
Dim i As Integer
Dim val As Integer

[code]...

View 3 Replies View Related

Modules & VBA :: Losing Decimal Place In Mail Merge

Sep 4, 2013

My DB is merge in a currency field set to 2 decimal places into word. It's doing this by declaring the fields as variable, calling an instance of work then dropping the values into the bookmarks. All works fine....

When a value is 360.64 is fine, but when it's something that ends with a 0 (360.60) - is loses the 0 giving me 360.6.

View 2 Replies View Related

Modules & VBA :: Change Number Of Decimal Places Based On Value In Textbox On Main Form

Apr 11, 2014

I have a subform that displays doubles in a textbox as fixed with 4 decimal places as default. I have been trying to change the number of decimal places based on the value in a textbox on the main form. I have tried this:

Code:
Forms![Main Form]![Holder_subform].Form![Final PCT].[DecimalPlaces] = CByte(Forms![Main Form].Numdecs)

where [Final PCT] is the textbox on the subform containing the decimal number and Numdecs is the textbox on the main form containing the number of decimals I want to use. I want to implement this Form_Current sub.

View 2 Replies View Related

Modules & VBA :: How To Convert Where Condition

Dec 15, 2013

Everything I have goggled and tried doesnt work How do I convert the where condition to VBA

Code:
Form name frmMap
View form
Filter name
Where condition [chid]=[forms]![frmCurchesAll]![chid]

View 12 Replies View Related

Modules & VBA :: Convert Weeks To First Day Of Month

Feb 28, 2014

I am trying to convert a week which is entered in a text box on a form to the first day of the month in which it falls.

My text box (txtdw) is in the format yyww and I want it to be converted to 01/mm/yyyy.

example: 1401 would convert to 01/01/2014. 1406 would convert to 01/02/2014.

I am pretty close, I can get to the correct month but I can't work out how to change to the first day of the month.

Code:
DateAdd("D", Right(Me.txtDW, 2) * 7, DateSerial("20" & Left(Me.txtDW, 2), 1, 1))

View 4 Replies View Related

Modules & VBA :: Trying To Convert Send Key Command To Something Newer

Jul 12, 2015

We have a ton of Access 97 DBs I've been asked to "fix". Since moving to Windows 7 some of them have been giving Error70 comands, which I've narrowed down to Sendkey not playing nicely with Windows 7. Anyway, I was able to fix it for one user by turning UAC off. Not my preferred way to operate, but it's a stopgap until I can get this mess sorted out.

Ok, here's the code. This is an event procedure that is tied to a date field where staff are to enter a date in MM/DD/YYYY format. For some reason there is no tab order anywhere on this DB so they have to click to enter. In the past they had to make sure that they clicked at the left most M in MM to make the entry.

It appears that this Sendkey is the culprit here. Is there anyway I can safely remove that w/o breaking something? I cannot get sole access to this DB as it's in use pretty much 24/7 until the 11pm backup for the server it resides on. It is Access 97. I was thinking of just pulling the macro from that field but then again I am not an Access person by any means,

Option Compare Database
Option Explicit

Private Sub cboxptno_GotFocus()
cboxptno.Dropdown
End Sub
----
Private Sub Command111_Click()
On Error GoTo Err_Command111_Click

[code]....

View 10 Replies View Related

Modules & VBA :: Convert A Month To Number In A Column

Oct 13, 2014

I have a table that has just Months in a column. As in January, February......

I want to convert these to Numbers as in 1-12 in VBA. I tried all the DatePart in every combination but can't seem to get the results.

View 5 Replies View Related

Modules & VBA :: Convert Linked Tables To Local?

Jul 1, 2015

I have the following script that either converts a single linked table to a local table or ALL linked tables to local tables, however I am getting the following 2 error messages on several tables for the ALL tables script.

error 3709, the search key was not found in any record

Error 3300, cannot create a relationship.

Code:
Sub Convert_Linked_Tables_To_Local()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb
GoTo Multi1

[code]....

View 5 Replies View Related

Modules & VBA :: Convert Variant To Access Table?

Aug 20, 2013

Creating a recordset from an Access table

Copy that recordset into a Variant variable, similar to a matrix

Run a Heuristic Algorithm on the matrix to populate values

Delete * from the orginal Access table

Input new data into the Original Access table by looping through matrix with an INSERT INTO statement.

This method works but I do not like the loop in step 5 as I am calling an INSERT INTO statement 800+ times and can be slow. Any way to view the variant as a whole and not have to loop through the entire matrix. Maybe possibly converting the variant to an Access tabledef.

View 2 Replies View Related

Modules & VBA :: Calculate Total And Convert Numbers To Words

Apr 7, 2014

I have a form that have textbox that calculate total and then i want to convert numbers to words. Iv got the code with function currencytotext but when i set the code source of another textbox to:

=currencytotext([inv_total])

I have an error. I saw this on internet but i think bcz I am using access 2013 may be the syntax is different a bit.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved