Data Validation Help

  • Thread starter Thread starter Jonathan Smith
  • Start date Start date
J

Jonathan Smith

I am developing a Database in Access 2002, and have a situation I cannot
resolve.

User enters Session Start Time (txtStrtTime) and Session End Time
(txtEndTime). Upon entry of Session End Time the AFTER UPDATE EVENT for
txtEndTime calculates the Session Length (txtLength).

I need to be able to do Two Things:

1. Have Session Length displayed as a Decimal, rather than as
Minutes.

2. Have a Message Box Pop-up if the calculated Session Length
(txtLength) is greater than 2.0.

Details:
Field Format
txtStrtTime Date/Time
txtEndTime Date/Time
txtLength Date/Time

Any/all suggestions are appreciated.
--
Jonathan Smith
Information Technologies Consultant
Spheniscidae
POB 61741
Phoenix, Arizona 85082-1741
602-758-9822
(e-mail address removed)
 
Jonathan, can we distinguish between the table and the form?

The table should not have a field named txtLength unless you can give a
valid reason why txtLength should sometimes be different than the difference
between the other 2 fields.

On the form, you can display the duration in a text box that has a Control
Source of:
=DateDiff("n", [txtStrtTime], [txtEndTime]) \ 60 &
Format(DateDiff("n", [txtStrtTime], [txtEndTime]) Mod 60, "\:00")

For an explanation, see:
http://allenbrowne.com/casu-13.html


For the other part of your question:
Private Sub txtEndTime_AfterUpdate()
If DateDiff("n", [txtStrtTime], [txtEndTime]) > 120 Then
MsgBox "Long session you got there!"
End If
End Sub
 
Back
Top