Checkbox Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am creating a database which holds staff training records.

There are four or five choices (e.g. fire, first aid) and a date completed.

I was wondering if you could make a Checkbox ticked if a course was taken
more than 3 years ago.

Thanks in advance
 
You could use something like the following in the form's Current event. If
you need help making that happen, post back.

If DateDiff("yyyy", [FirstAidDate], Date) > 3 Then
Me.chkFirstAid = True
Else
Me.chkFirstAid = False
End If

[FirstAidDate] is the date field being evaluated. chkFirstAid is the check
box for First Aid. Substitute actual field and control names, of course.
Reverse False and True as needed.

General question to somebody: When I used Me.FirstAidDate in the DateDiff
expression, it did not work. The expression invariably evaluated to >3 (I
added a temporary message box at Then to test). What's up with that?
 
Upon closer examination, the code I provided in the previous post has
limitations. In addition to what I have written, see the following (it was
in the post immediately before yours):
http://allenbrowne.com/func-08.html

You may get acceptable results if you use months instead of years in
DateDiff:

If DateDiff("m", [FirstAidDate], Date) > 36 Then
Me.chkFirstAid = True
Else
Me.chkFirstAid = False
End If
 
Back
Top