I have a program which works out the persons age and then assigns them a "Squad number". I have got it working if the year is a normal year but the squad numbers year works from the 1st Sept to the 31 Aug the following year.. (Basically a UK schooling year)
I cant see how to convert this code to work using the UK schooling year... Any ideas?
I cant see how to convert this code to work using the UK schooling year... Any ideas?
Code:
Private Sub List1_Click(Index As Integer)
'Build the criteria to search for.
sql = "SELECT * FROM [Account Master] WHERE [Name] = " & """" & List1(Index).Text & """"
Set rs = db.OpenRecordset(sql, dbOpenDynaset)
If Not rs.EOF Then
'Record found
LblAge1(Index).Caption = DateDiff("yyyy", rs!DateofBirth, Now()) + Int(Format(Now(), "mmdd") < Format(rs!DateofBirth, "mmdd"))
If LblAge1(Index).Caption > 18 Then
MsgBox "This person is over 18 and unable to bowl in YBC tournaments"
Lblsquad(Index).Caption = "?"
End If
If LblAge1(Index).Caption = 18 Or LblAge1(Index).Caption = 17 Then
Lblsquad(Index).Caption = "A"
End If
If LblAge1(Index).Caption = 16 Or LblAge1(Index).Caption = 15 Then
Lblsquad(Index).Caption = "S"
End If
If LblAge1(Index).Caption = 14 Or LblAge1(Index).Caption = 13 Then
Lblsquad(Index).Caption = "J"
End If
If LblAge1(Index).Caption = 12 Or LblAge1(Index).Caption = 11 Then
Lblsquad(Index).Caption = "B"
End If
If LblAge1(Index).Caption <= 10 Then
Lblsquad(Index).Caption = "P"
End If
End If
End Sub