Hi,
I have a form which contains the fields "first visit date" (contains today's date in date/time format), age and birth year (as number).
I want to caculate the year of birth by filling the other 2 fields. I wrote the following code for this but it doesn't work.
I'm an absolute newbie. Please help.
I have a form which contains the fields "first visit date" (contains today's date in date/time format), age and birth year (as number).
I want to caculate the year of birth by filling the other 2 fields. I wrote the following code for this but it doesn't work.
Code:
Private Sub txtAge_AfterUpdate()
Dim thisyear As Integer
Dim birthyear As Integer
Dim age As Integer
thisyear = Year(#Me.txtFirstVisit#)
age = Me.txtAge
birthyear = thisyear - age
If Me.txtBirthYear = Null Then
Me.txtBirthYear = birthyear
End If
End Sub
I'm an absolute newbie. Please help.