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

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.
 
D

Douglas J. Steele

Set the control source of the check box to

=DateDiff("n", Nz(Me.Text1, 0), Nz(Me.Text2, 0)) > 60
 
J

John W. Vinson

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.
 

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