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

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 2161
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:
TotalTimeInMinutes: DateDiff("n",BeginTime, 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.googlegr oups.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.googlegr oups.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
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...
0
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...
1
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...
3
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
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...
25
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...
25
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...
10
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...
3
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...
4
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
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.