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

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".
I have tried entering placing formulas in both the Start sampling time and the End Sampling time and only get errors.
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?  

Who is Participating?
Gustav BrockCIOCommented:
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.

Dale FyeCommented:
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

Pawan KumarDatabase 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 -
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Subodh Tiwari (Neeraj)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

cssc1Author Commented:
Thank you all!!
cssc1Author Commented:
Thank you everyone!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.