If calculation in text box > 1 hour set check box = True

  • Thread starter Thread starter Jmac
  • Start date Start date
J

Jmac

I have three fields as follows;

Text1 = TimeStart
Text2 = TimeEnd
Text3 = Calculates the difference in the time (Text1 - Text2)

I then have a check box (and this is where my problem arises).

Check1 = I want to set the check box to True (checked) if Text3 >60
minutes and False (unchecked) if under 60 minutes.

I have been unable to get an answer from the internet for days and no-
one has asked this question on any of the search results that I look
at.

Any helpers? Thanks in anticipation.
 
Set the control source of the check box to

=DateDiff("n", Nz(Me.Text1, 0), Nz(Me.Text2, 0)) > 60
 
I have three fields as follows;

Text1 = TimeStart
Text2 = TimeEnd
Text3 = Calculates the difference in the time (Text1 - Text2)

I then have a check box (and this is where my problem arises).

Check1 = I want to set the check box to True (checked) if Text3 >60
minutes and False (unchecked) if under 60 minutes.

I have been unable to get an answer from the internet for days and no-
one has asked this question on any of the search results that I look
at.

Any helpers? Thanks in anticipation.

If you're just subtracting the two times in Text3, you'll get the difference
in fractional days (not minutes). You can use the DateDiff function instead.

You can set the checkbox's Control Source property to

=(DateDiff("n", [TimeStart], [TimeEnd]) > 60)

The DateDiff function will calculate the time in minutes; the inequality will
be either TRUE or FALSE which will display as checked or blank.
 
Back
Top