Adding Total Running Time from Begining and Ending Time

D

david.tiberia

Hi,

I am creating a database for logging video tapes. I've managed to
figure everyting out except for the following:

My form has entries for begining and ending timecode of each piece of
video. Each have seperate entries for hour, min., sec. and frames.
The next entry is the total running time of the piece, that has entries
for both hour, min., sec. and frames. I want the form to automaticaly
fill in the total running time by doing math to the begning and ending
time entries. This would require converting the hours to frames and
subtracing the ending frames from the begining frames, then converting
them back. It would also need to ingore and negative numbers. I
thought I could do this using the expression builder. Does anyone have
any sugestions as to how I would acomplish this. I have been looking
through old posts but haven't found anything helpful yet. Thanks!

- David
 
D

David

Thought an example of what I had set up might help. I had this
inserted in the event tab under "On Got Focus"

( [Ending Timecode Hour].BeforeUpdate * 1800 ) - ( [Begining Timecode
Hour].BeforeUpdate * 1800 ) / 1800

Sorry, didn't think of adding what I had put in till after I had
published the first message
 
G

Graham Mandeno

Hi David

The frame number can be calculated from:
((([hour]*60+[min])*60+[sec])*[fps])+[frame]
(fps is frames per second)

To split it apart again, you will need to write a function.

[WARNING: Air code ]

Public Type uHMSF
h As Integer
m As Byte
s As Byte
f As Byte
End Type

Public Function FrameToHMSF(ByVal frm As Long, fps As Byte) As uHMSF
Dim lTemp As Long
With FrameToHMSF
.f = frm Mod fps
lTemp = frm \ fps
.s = lTemp Mod 60
lTemp = lTemp \ 60
.m = lTemp Mod 60
.h = lTemp \ 60
End With
End Function

To call this you would need to declare a variable in your code:

Dim MyHMSF as uHMSF

MyHMSF = FrameToHMSF(372620,100)

With MyHMSF
Debug.Print .h, "hours"
Debug.Print .m, "mins"
Debug.Print .s, "secs"
Debug.Print .f, "frames"
End With

This would give 1, 2, 6, 20
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top