Hi
I am new to using Microsoft Access and understanding VBA.
I hope someone can help me on my two problems with VBA in Access :-
1. I have two fields in my table Age and DateofBirth and what I would like to do is calculate their Age when someone inputs their DateofBirth. The calculation is based on 01/09/2002 minus the entry in the DateofBirth field and the result goes in the Age field. Please note that 01/09/2002 remains constant in this problem. Also could you tell me where to put the code e.g. BeforeUpdate or OnFocus for example.
2. I have two fields one called MemberID and the other called Team. When ever someone inputs the MemberID field then it automatically enters the corresponding Team entry in the field. I have used this example shown below but it does not work.
Dim strMemberID As String
strMemberID = [Member].Text
Select Case MemberID
Case "1"
txtTeam = "Under 8s"
Case "2"
txtTeam = "Under 9s"
Case "3"
txtTeam = "Under 10s"
End Select
I am new to using Microsoft Access and understanding VBA.
I hope someone can help me on my two problems with VBA in Access :-
1. I have two fields in my table Age and DateofBirth and what I would like to do is calculate their Age when someone inputs their DateofBirth. The calculation is based on 01/09/2002 minus the entry in the DateofBirth field and the result goes in the Age field. Please note that 01/09/2002 remains constant in this problem. Also could you tell me where to put the code e.g. BeforeUpdate or OnFocus for example.
2. I have two fields one called MemberID and the other called Team. When ever someone inputs the MemberID field then it automatically enters the corresponding Team entry in the field. I have used this example shown below but it does not work.
Dim strMemberID As String
strMemberID = [Member].Text
Select Case MemberID
Case "1"
txtTeam = "Under 8s"
Case "2"
txtTeam = "Under 9s"
Case "3"
txtTeam = "Under 10s"
End Select