Yes, this is possible using the form's onload and onclose events. Your two
forms need to include something like the following:
On form 1:
'''declarations section'''
Dim timeOpen As Date
Private Sub btnCancel_Click()
DoCmd.Close acForm, Me.name
End Sub
Private Sub btnOK_Click()
'on click statements...
End Sub
Private Sub Form_Close()
DoCmd.OpenForm FormName:="timerForm2", openargs:=CStr(timeOpen) & "|" &
CStr(Now)
End Sub
Private Sub Form_Load()
timeOpen = Now
End Sub
....and on form 2:
Private Sub btnCancel_Click()
DoCmd.Close acForm, Me.name
End Sub
Private Sub btnOK_Click()
'on click statements...
End Sub
Private Sub Form_Load()
Dim args As Variant
args = Split(openargs, "|")
labelResults.Caption = "Last form was opened at " & args(0) & " and was
closed at " & args(1) & vbCrLf & "Time elapsed was " & DateDiff("s", args(0),
args(1)) & " seconds."
End Sub
All that happens in form 1 is that when it's opened, it calls the Now
function to store the date and time in the globally scoped variable timeOpen.
When the form closes, it calls Now again and uses the openargs parameter of
the docmd.openform method to pass the two valus to form 2 as strings.
In form 2, the onload event gets the openargs, splits them into a simple
array, and calls datediff to work out the elapsed time (datediff works on
anything that looks like a date, even if it's not of the Date type). I've
done it in seconds, but you can obviously tailor this to your requirements.
Another approach would be to time how long form 1 is open by calling the
timer function when it's opened, calling it again when it closes, and
comparing the values.
Hope that's what you're after.
G