Microsoft KB Archive/100141: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (X010 moved page Microsoft KB Archive/Q100141 to Microsoft KB Archive/100141 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
 
(No difference)

Latest revision as of 18:13, 12 August 2020

INF: How to Use TimeValue() to Calculate Difference in Times

PSS ID Number: Q100141 Article last modified on 03-13-1995

1.00 1.10 2.00

WINDOWS

The information in this article applies to:
- Microsoft Access versions 1.0, 1.1, and 2.0

SUMMARY

This article describes how to use the TimeValue() function to find the difference between two values that have Date/Time data types and that occur within a 24-hour period.

MORE INFORMATION

To set up an example that uses the TimeValue() function, create a form with the following text boxes:

Object: Text Box
ControlName: Start_Time
Object: Text Box
ControlName: End_Time

To calculate the difference between the times in these two fields, create a third text box with the following properties:

NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore when re-creating this code.

Object: Text Box
ControlName: Time_Difference
ControlSource: =Format(TimeValue([End_Time])_
-TimeValue([Start_Time]),“Short Time”)

Note that in the example above, the Format() function is used to format the time difference. Short Time displays the difference in hours and minutes.

REFERENCES

For more information on formatting values, search for “format” then “format, format$” using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 KBCategory: kbprg KBSubcategory: PgmOthr

=================================================================

Copyright Microsoft Corporation 1995.