How to convert the time between to fields into total minutes?

PROBLEM DESCRIPTION
I have an ms access application with two fields the you enter the beginning sampling time and the ending sampling time. THe field that I wanted to have automatically updated this the total sampling minutes is the "total Sampling Time in Minutes Field".
WHAT I HAVE TRIED
I have tried entering placing formulas in both the Start sampling time and the End Sampling time and only get errors.
RECREATE PROBLM
Recreate problem

1.      Open application
2.      The application will open to form: frmlSilicSamplingSetup
3.      Click the Sample Setup button
4.      Enter ID: 1
5.      Scroll down to the bottom of the screen until you reach the green section.
6.      In the green section, look for the following fields:
      Sampling Start Time
      Sampling End time
      Total Sampling Time in Minutes

7.      Notice how the field “Total Sampling Time” does not calculate the total minutes of sample time. This is what I cannot figure how to do?  


aNY HELP IS APPRECIATED
Silica_App---V3---Copy---Copy---Co.accdb
cssc1Asked:
Who is Participating?
 
Gustav BrockConnect With a Mentor CIOCommented:
You doesn't need the total field in table. Remove it, and set the ControlSource of the total textbox on the form to:

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

Open in new window


That said, you really should read up on how to normalize a database. Your table is a monster, and - as is - it will cause you headaches sooner or later.

/gustav
0
 
Dale FyeConnect With a Mentor Commented:
I cannot download your database at the moment, but if the two fields involved are of date/time data type, then you should use the DateDiff() function.  Format would look something like:

ElapsedTime: DateDiff("n", [StartDateTime], [EndDateTime])

the "n" represents minutes as "m" represents month

Dale
0
 
Pawan KumarConnect With a Mentor Database ExpertCommented:
How you are calculating minutes ? ...Same as Dale Suggested.. you need to use like below

[Total Sampling Time in Minutes] = DATEDIFF("n",[Sampling Start Time],[Sampling End time])

Refer DateDiff for more details - https://www.techonthenet.com/access/functions/date/datediff.php
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Subodh Tiwari (Neeraj)Connect With a Mentor Excel & VBA ExpertCommented:
If the Sample Start Time and Sample End Time have the Date/Time datatype, the above solutions would work for you. Make sure both times have the correct data type.

And in that case you may also try this formula to get Total Sampling Time in Minutes...
([Sampling End Time]-[Sampling Start Time])*24*60

Open in new window

0
 
cssc1Author Commented:
Thank you all!!
0
 
cssc1Author Commented:
Thank you everyone!
0
All Courses

From novice to tech pro — start learning today.