Date time span

ddrew

seasoned user
Local time
Today, 22:31
Joined
Jan 26, 2003
Messages
911
I wonder if someone can help me with this? I am trying to get my form to automatically check when a person becomes a senior from a junior. I ahe two option buttons Junior and Senior and a date of birth box. I am trying to ask if the time span is less than 16 then the person is a junior if the time span is greater than 16 then the person is a senior. I need this to auto update the two option boxes when the person attains the age of 16. This is my code so far but its not right!

Private Sub DOB_AfterUpdate()

'If the date entered is less than 16 years before today's date then they are a junior
If Me.DOB > DateAdd("yyyy", -16, Date) Then
Me.Junior = True
Me.Senior = False
End If
If Me.DOB < DateAdd("yyyy", 16, Date) Then
Me.Senior = True
Me.Junior = False
End If
 
Dob

In the After Update of the Field DOB put this:

Dim Age As Double
Age = Year(Now()) - Year([DOB])

If Age < 16 Then
Me.Junior = True
Me.Senior = False
Else
Me.Senior = True
Me.Junior = False
End If
 
Ok that works, now for the difficult bit. Thank you. How do i get it to incorporate an auto update feature. i.e once the person has passed their 16th birthday, I want the DB to realise that and change the option from junior to senior

What about an on 'open event' on the form?
 

Users who are viewing this thread

Back
Top Bottom