473,698 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CALCULATING TIME

I am trying to device a formula so that when i check of a yes/no box
(done) it will automatically add the time in a field called "End
Time" and at the same time stamp the amount of minutes between a field
"begining Time" ( which already automatically stamps the time as you
enter a new record) and the field "end time"

For example : If I begun the new record at 2:45 PM worked on the
problem untill 3:00 PM and solved it. I would then proceed to check of
the box in the field "Done" this would then stamp 3:00 PM in the field
"End Time", and also would stamp 15 in the "Total Time" Field.

I have spent about 15 hours reading in the Microsoft help and I am as
ignorant on how to do this as before I begun.

Thanks for the help

manuel

Nov 13 '05 #1
4 2180
On 4 Feb 2005 06:04:02 -0800, "luscus" <LU****@NETZERO .NET> wrote:

In the checkbox' AfterUpdate event write one line:
txtEndTime = Time
(replace txtEndTime with the name of your text box)

Total Time is a different story. It is what's called a Calculated
Field, and should not be stored in the database. Rather you
recalculate it when you need it, typically in a query.
So you create a new query, select your table, drag some fields to the
grid, and in a new field write:
TotalTimeInMinu tes: DateDiff("n",Be ginTime, EndTime)
(replace BeginTime and EndTime with your field names)

-Tom.

I am trying to device a formula so that when i check of a yes/no box
(done) it will automatically add the time in a field called "End
Time" and at the same time stamp the amount of minutes between a field
"begining Time" ( which already automatically stamps the time as you
enter a new record) and the field "end time"

For example : If I begun the new record at 2:45 PM worked on the
problem untill 3:00 PM and solved it. I would then proceed to check of
the box in the field "Done" this would then stamp 3:00 PM in the field
"End Time", and also would stamp 15 in the "Total Time" Field.

I have spent about 15 hours reading in the Microsoft help and I am as
ignorant on how to do this as before I begun.

Thanks for the help

manuel


Nov 13 '05 #2
luscus wrote:
I am trying to device a formula so that when i check of a yes/no box
(done) it will automatically add the time in a field called "End
Time" and at the same time stamp the amount of minutes between a field
"begining Time" ( which already automatically stamps the time as you
enter a new record) and the field "end time"

For example : If I begun the new record at 2:45 PM worked on the
problem untill 3:00 PM and solved it. I would then proceed to check of
the box in the field "Done" this would then stamp 3:00 PM in the field
"End Time", and also would stamp 15 in the "Total Time" Field.

I have spent about 15 hours reading in the Microsoft help and I am as
ignorant on how to do this as before I begun.


You have some basic design flaws in your table structure (easily remedied
though).

First off any record where [End Time] is not Null will by definition be
"Done" so you do not need a separate Yes/No field to indicate done you
should eliminate that field and replace the CheckBox on your form with a
button that simply fills in the [End Time] field.

Me![End Time] = Now()

Second, since the difference in minutes between [Start Time] and [End Time]
can be easily calculated on-the-fly, there is no reason to have a separate
field to store that value either. That field should also be eliminated from
your table. On your form all you need is a TextBox with the expression...

=DateDiff("n", [Start Time], [End Time])

To eliminate having to write this expression multiple times in various forms
and reports you can create a query that includes all the data from your
table, but also adds a calculated field [Total Time] using the same
expression. Then you simply use the query every place you are now using
your table. You could also add a calculated field to the query to give you
your [Done] Yes/No field with = Not IsNull([End Time])

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #3
Not sure how you'll handle cases where the user clicks the "Done" checkbox
to undo, but:
1. in the On Change event of the "Done" checkbox, put:
If Me!myDone = -1 Then
Me!myEndtime = Now()
Else
End if

-substitute the names of your done checkbox and end time controls
This puts the current system time in the End Time control (and stores it in
the table when form is closed) anytime that the user puts a check in "Done".

2. create an unbound text box on your form for "TotalTime" ; make the
control source: =DateDiff("n",[Starttime],[Endtime])

This calculates the time difference between "Start" and "End" and displays
the result. That value is not stored, but can be recalculated whenever
needed fro other forms/reports.

That's it!

BTW, it's generally better to not have spaces in your field/control names.
If you do, always enclose them in square brackets "[ ]" when referring to
them by name.
-Ed
"luscus" <LU****@NETZERO .NET> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I am trying to device a formula so that when i check of a yes/no box
(done) it will automatically add the time in a field called "End
Time" and at the same time stamp the amount of minutes between a field
"begining Time" ( which already automatically stamps the time as you
enter a new record) and the field "end time"

For example : If I begun the new record at 2:45 PM worked on the
problem untill 3:00 PM and solved it. I would then proceed to check of
the box in the field "Done" this would then stamp 3:00 PM in the field
"End Time", and also would stamp 15 in the "Total Time" Field.

I have spent about 15 hours reading in the Microsoft help and I am as
ignorant on how to do this as before I begun.

Thanks for the help

manuel

Nov 13 '05 #4
For the End Time field, look at the datePart() Function,
For the TotalTime field, look at the dateDiff() Function.

hth,

Jim Evans

"luscus" <LU****@NETZERO .NET> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I am trying to device a formula so that when i check of a yes/no box
(done) it will automatically add the time in a field called "End
Time" and at the same time stamp the amount of minutes between a field
"begining Time" ( which already automatically stamps the time as you
enter a new record) and the field "end time"

For example : If I begun the new record at 2:45 PM worked on the
problem untill 3:00 PM and solved it. I would then proceed to check of
the box in the field "Done" this would then stamp 3:00 PM in the field
"End Time", and also would stamp 15 in the "Total Time" Field.

I have spent about 15 hours reading in the Microsoft help and I am as
ignorant on how to do this as before I begun.

Thanks for the help

manuel

Nov 13 '05 #5

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

Similar topics

5
8800
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any feedback on how I might do things differently to make it either more consice, readable, or faster. ie... are there better ways to do it in Python? It won't break any records for calculating pi, that wasn't my goal, learning Python was. But it might...
0
2268
by: Kasp | last post by:
Hi there, I am trying to make an OLAP cube on a table having two columns (datetime, Number_of_times_an_event_occured). My dimension is time and I want to measure the Min and Max times an event occured over time. I have no problem in calculating Maximum occurance of events over time. However, I have some NULL values in my Number_of_times_an_event_occured column, due to which I don't see any result when I try to calculate
1
2375
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on this form. Any employee can have multiple entries in the table (key fields are EmpID and LeaveID) for multiple dates (John Doe can take 3 days annual leave, then take 3 days sick leave in any given month. I have a BeginningBalance of hours that...
3
5344
by: Miller | last post by:
Hi, Can someone tell me how to calculate MFLOPS for the following C# code (on a Pentium 4 2.0 Ghz)? for (i=0; i<n; i++) { for (j=0; j<n; j++) { for (k=0; k<n; k++)
12
2930
by: jUrner | last post by:
Hello all I have the problem of how to calculate the resolution of the system clock. Its now two days of head sratching and still there is nothing more than these few lines on my huge white sheet of paper stiring at me. Lame I know. import time
25
5010
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for learning advanced C.thx.
25
3198
by: Blaize | last post by:
Hi, I'm having an issue trying to calculate time. Its okay if the value does not exceed 24 hours otherwise I get a date and hours listed. For example, I have a loop which looks through a table and adds up the time spent. Dim TempCount As Date Dim DEVCount As Date Do TempCount = rst!wtime
10
5238
freddieMaize
by: freddieMaize | last post by:
Hi there, I need to hit few list of sites from my application and find the response time of those site and sort them (which ever is opening first will sit at the top). I have done the same using java (server side). Now my requirement is do in the client side (AJAX possibly). Iím having two challenges. Below is what I have done so far, <script> function call() { var d = new Date(); var xmlHttp;
3
1735
by: mfaisalwarraich | last post by:
Hi everybody. I have some problem while calculating time. i have employees who are working on hourly basis. i want to calculate the time. for example if an employee start working at 11:00pm (10-November-2008) and finish his job at 8:00am (11-November-2008) then how i can calculate the time between two different dates? i used dateDiffer method but it only displays the time difference between one date. please tell me how i can do this. thank you....
4
3937
by: Missionary2008 | last post by:
Thank you in advance for your help. I'm trying to calculate the Total Time in hours and minutes to complete a job. The way we are calculating it is by taking the Fee paid and dividing that by a 1:00. In Excel - Marsh is charged $90.00 (This is pre-determined) Her job is a $25.00/hour job (This is pre-determined) The Raw Hours to complete the job is 3.6 hours (I have this already in a qry) ...
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8609
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
9166
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
9030
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
6525
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
5861
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
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
3
2007
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.