Subtracting Time Fields
Mar 26, 2005
Before I start implementing this, I would like to know if it is possible to do in principle
I want two fields, say TimeStarted and TimeEnded. I then want to subtract the two from one another to see how long the task took.
Is this possible or would i be wasting my time trying it?
View Replies
ADVERTISEMENT
Jun 20, 2006
I have two times I need to subtract in a query. When I subtract these in the query I get a decimal point. How can I convert this data. Thanks
View 1 Replies
View Related
Oct 21, 2005
My new job requires me to use access so I'm learning as I go. :confused:
I have already used previous threads from this forum to answer another problem I encountered. Thanks for providing this forum to the public!
I am attemping to run a query that will subtract military time. (I am not allowed to change the format of the times in the original tables. )
Example:
Column A Column B
1111 6.5
I need 1111 - 6.5 in Column C
View 4 Replies
View Related
Mar 27, 2006
Any Help!
I have fields that are time formated 99/99/99" "00:00;0;_ and I want to subtract them.
I need to get the results in two forms; first in Days and second in Hours. I have used the obvious subtract one from the other and it gives me days in a rounded numbeer, but the hours is not working out.:confused:
DB
View 4 Replies
View Related
Dec 9, 2004
Hello again,
I think my subject heading explains it. How would you add or subtract two short time formatted values and produce a short time value? Also, how would you change a short time value into number minutes. (i.e. 5:30 into 330) Thanks!
G
View 1 Replies
View Related
Jan 23, 2008
Hi I have two fields one which represents the time participants went to sleep, one when they woke up however I dont have any dates - it refers to what they do usually. Is it possible to minus sleeptime from waketime to determine duration of time in bed without dates? Or do I assign dummy dates to use date diff function?
View 4 Replies
View Related
Nov 13, 2007
I am trying to subtract 12 hours from a time-date field when the payperiod does not equal 01.
in a query I have:
work date: iif([payperiod]="01",[StartTime],[starttime]-#12:00:00#) - Access added a PM before the second hash so it looks like this:
iif([payperiod]="01",[StartTime],[starttime]-#12:00:00 PM#)
When I run the query I get a message box: "syntax error (missing operator) in query expression '00:00:PM#,2))". I am unable to open the query to correct the error. I can cop the unaltered query from a back up database.
My question is how do I subtract the 12 hours.
Thanks
Steve
View 3 Replies
View Related
Jul 10, 2013
I have an Access query which has 2 fields 'Sent Date' and 'Return Date'. Sent date is input by the user when they return an item for repair, return date is input by the user when the item is sent back to us from repair. What I need is a 3rd calculated field which will work out the number of days the item was away for repair. I have included the 3rd column 'Repair Duration' but I don't know how to type the formula in the query to work this out.
View 7 Replies
View Related
Mar 21, 2012
I'm trying to create an expense report based off two tables. I have a table for Bouts, and a table for Bout transactions. In the Bout transaction table there is a field that specifies whether the transaction is an expense or a revenue.
I'm trying to create a report that will split the transactions out by expenses and revenues, then in the summary show the total income, (income - expenses.) I have the report formatted, but I'm not sure how to get the grand total.
I currently have the report laid out as such:
Bout Name
Revenue
Sample Revenue 1 $100
Sample Revenue 2 $50
Revenue Total: $150
Expenses
Sample Expense 1 $100
Expense Total: $100
Net Total: (I would like to subtract the 150 from 100 here)
View 6 Replies
View Related
Jan 2, 2007
Hello everyone, I'm encounter a problem trying to write a code.
EX:
Date Months_to_credit Final_result
01/31/06 4 10/01/05
02/28/06 6 09/01/05
03/31/06 8 08/01/05
Does anyone have any ideas how to to substract Months_to_credit from Date and to return a date in the Final_result field?
View 1 Replies
View Related
Mar 13, 2014
I have a database with date and time each stored in a separate field. Now I want to query the database based on a start date/time and an end date/time. I started with the code below but it only returns events within the same time range on each day when what I really need is every event from a specified date and time through a specified date and time.
SELECT myTable.ID AS myTable_ID, myDate, myTime, FirstName, LastName
FROM Staff INNER JOIN myTable ON
Staff.ID = myTable.StaffID
WHERE myTable.myDate >= #3/2/2014#
AND myTable.myDate <= #3/3/2014#
AND myTable.myTime >= #8:00PM#
AND myTable.myTime <= #11:00PM#
ORDER BY myDate desc
In the above example what I want is every event from 3/2/2014 8:00PM until 3/3/2014 11:00PM. But what I get instead is every event between 8:00PM and 11:00PM on 3/2/2014 and every event between 8:00PM and 11:00PM on 3/3/2014.
View 4 Replies
View Related
Oct 10, 2005
I'm trying to do a calculation in access that will allow a user to receive a discount in one field and show the results in another. The form looks like this. Having a hard time figuring out the line total. It's giving me a the wrong amount. The employee discount is $.20 and the price is $2.27 for example.. Thanks
Bound text box [UnitPrice] - Bound text box [EmployeeDiscount] x Bound text box [Quantity] =
Bound text box [LineTotal]
View 1 Replies
View Related
Feb 23, 2008
Hi everyone,
I am familiar with databases and basic SQL, but never used Access, so your help is greatly appreciated!
What I *think* I need to do here is take the results from one query, subtract another query from that, then create a table of the results, so that I can make a chart in a report. I say that I *think* I need do that because I’m not confident that this approach is the best but that’s a whole other story...
Please look at the following tables below for an example. The Item table has ItemCode as a primary key. The Bids Table has multiple rows for each ItemCode showing bids for the item:
Item Table
ItemCode Date Address
JH231 2008-Feb-20 123 Test St.
KH831 2008-Feb-21 512 Test St.
Bids Table
ItemCode Amount
JH231 100.00
JH231 60.00
JH421 310.00
KH831 20.00
KH831 40.00
KH831 10.00
KH831 90.00
To make a pretty graph, I would like a table (so a query, or macro, or VBA or something?) that returns the minimum Amount for an ItemCode subtracted from the maximum Amount for an ItemCode based on the example above. What I would end up is something like this:
ItemCode Difference Between Maximum and Minimum
JH321 250
KH831 80.00
I hope this is clear. Any help on how to do this from you Access pros would be great, OR if I’m taking the wrong approach, suggestions on what I should try next. Thanks!!!
Marc
View 6 Replies
View Related
Mar 15, 2006
Can you calculated time in a query?
Such as hours during any given day?
View 2 Replies
View Related
Mar 13, 2014
I have a form generated from infopath where users enter the amount of time it took them to complete a task. It is set up right now in time format, so a user would enter Task A-0:15 (to show 15 minutes). Users have multiple tasks with different times and I would like to be able to show a total for all those tasks combined.
Task A-0:15
Task B-0:45
Task C-1:30
Task D-0:30
Total = 3:00 <------This is what I would like to do
View 1 Replies
View Related
Jul 15, 2014
I have an Access 2010 database that tracks Classroom Training. I have a "Start Time" field for each class and a "Duration" field for the length of each class. The Start Time field is a date/time data type and the Duration field is a number data type set to Double with 1 decimal place.
Example:
Start Time = 8:00
Duration = 1.5
So the class should have an End Time at 9:30. I have been able to convert the "Duration" field to a time field for example 1.5 now displays 1:30.
My question is how do I add the 2 fields together to get an End Time of 9:30 ?
View 5 Replies
View Related
Nov 9, 2005
Hi, I have a data base that is used to keep track of stock level. When i issue a stock item and move to the next record I would like the stock level to be reduced by 1, any ideas.
View 2 Replies
View Related
Jun 16, 2005
Hi, here's the situation:
I have a query A, that gives me the a set of numbers.
I have a query B, that gives me another set of numbers.
Numbers in B are always equal or larger than those in A. (B >= A)
I want to create a new query C, that does the subtraction. (C = B-A)
Here's an example to explain what I want.
Let's say I have A=4,7 and B=6,9
Now, when I create the query, I get the following result:
A | B | C=B-A
4 | 6 | 2
4 | 9 | 5
7 | 6 | -1
7 | 9 | 2
What I want is this:
A | B | C=B-A
4 | 6 | 2
7 | 9 | 2
How do I do that?
Thanks.
View 2 Replies
View Related
Dec 12, 2005
I found the following code on this site in a search for a method to subtract two dates ie [Startdate] and [EndDate] and display the result as a whole number. ie 2, 6 etc. This code finds the difference but displays the results as 1 year 5 months 2 days, where I need the equivalent as 17.
Can this code be modified to produce the desired result and if so how would I go about it. Thanks for the help.
Option Compare Database
Option Explicit
Public Function getTimeElapsed(StartDate, Optional EndDate As Date) As String
On Error GoTo Err_Handler
If IsNull(StartDate) Then
getTimeElapsed = "No startdate"
Exit Function
End If
Dim YY As Integer
Dim MM As Integer
Dim DD As Long
' use current day if EndDate is not supplied,
' + 1 makes both days inclusive.
EndDate = IIf(EndDate = 0, Date, EndDate) + 1
MM = DateDiff("m", StartDate, EndDate)
DD = DateDiff("d", DateAdd("m", MM, StartDate), EndDate)
' recalculate if DD is negative.
If DD < 0 Then
MM = MM - 1
DD = DateDiff("d", DateAdd("m", MM, StartDate), EndDate)
End If
YY = MM 12 ' integer division.
MM = MM Mod 12 ' remainder.
getTimeElapsed = YY & IIf(YY < 2, " year ", " years ") & _
MM & IIf(MM < 2, " month ", " months ") & _
DD & IIf(DD < 2, " day", " days")
Exit Function
Err_Handler:
MsgBox Err.Description
Exit Function
End Function
View 1 Replies
View Related
Sep 7, 2007
How do i subtract one value, worked out using a query, from another value, worked out using a query, and display it in a text box?
View 7 Replies
View Related
Jun 2, 2006
I am looking to subtract number inside the same field. and then return the difference to a new field (column). This data is used to generate a graph and the this is currently done by hand. I know there has to be an
easier way to do this.
Below is an example of what I am looking for.
I have a table called Numbers, and fields or columns called...
Value(s) Result(s)
-70 0
-70 1.02
-68.98 1.09
-67.89 3.11
-71 .71
-69.29 1.52
-67.77
So what I am doing is subtracting row two from row one. The difference is then put in another field(column) in row one. The process repeats, row three from two, four from three, five from four, etc, etc. This occurs for hundreds of rows.
Is there a SQL statement that can do this? Your help is much appreciated!!!
Thanks for your help.
View 3 Replies
View Related
Feb 1, 2013
My form consists of a textbox with a selected date. I have a combo box with integers 1-15. I have a table with 15 people and their birthdays.
I am trying to find the birthdays after a selected date by the integer selected in the combo box. For example, if I select 2/1/2013, and pick 7 in the combo box, the subform should show me people with birthdays 2/1 through 2/8.
I have a query with a datediff function. This is my query expression Expr1: DateDiff("d",[DateofBirth],[Forms]![Calendar]![Text1]) The criteria is <=[Forms]![Calendar]![Combo3].
It displays some data, but it's not consistent at all. I'm hoping to fix this without any SQL changes or form code. But if that's what I need, I'll do it.
I'm using access 2010, and I'm fairly new at it.
View 1 Replies
View Related
Jun 12, 2006
I'm working with a linked table that has a seperate field for the date, and a seperate field for the time (which show in the linked table as '11/30/1899 9:46:00 AM'). I need to calculate the time difference between 2 entries.
How can I merge the 2 fields into a combined date/time field for my calculations?
Thanks,
Sup
View 4 Replies
View Related
May 30, 2007
i'm relatively advanced Access user but this problem has got me stumped....i've been given a table that's basically a log of operating rooms with fields designating the date, the room number, "patient in room" time and "patient out of room" time. basically, i want to calculate the turnaround time which is the "patient in room" time" minus the "patient out of room" time from the previous record (if records are sorted in sequential order).
any thoughts?
View 10 Replies
View Related
Apr 4, 2005
I have a form that asks 2 questions. Date and Account. I need to check a table to see if the combination of both date and account have not been used. Date is normally today, can be yesterday. Account has a drop down menu with 6 choices. If both the date and account have been used then there should be an error shown to that effect. If not used, then proceed on to the next form for data entry.
Can this be done? And how?
View 1 Replies
View Related
Jun 26, 2013
I'm creating a form, and all the fields moved together. How do you unlock the field so you can move each one individually. I don't need them in columns as they are, nor the same size.
View 1 Replies
View Related