[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 45
  • Last Modified:

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
0
cssc1
Asked:
cssc1
4 Solutions
 
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

Dale
0
 
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 - https://www.techonthenet.com/access/functions/date/datediff.php
0
 
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

0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
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.

/gustav
0
 
cssc1Author Commented:
Thank you all!!
0
 
cssc1Author Commented:
Thank you everyone!
0

Join & Write a Comment

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now