Hi there!
I'm trying to group employees into age groups to see percentages per age group. This is my code:
I'm getting this error:
Syntax error (missing operator) in query expression '(([CSH Employees].status)<>"form er")
Public Function AgeGroup(DOB As Date) As String
Dim intAge As Integer
'Age Calculation
intAge = DateDiff("yyyy" , [DOB], Now()) + _
Int(Format(Now( ), "mmdd") < Format([DOB], "mmdd"))
What am I missing or doing wrong?
I'm trying to group employees into age groups to see percentages per age group. This is my code:
Code:
SELECT [CSH Employees].DOB, [CSH Employees].status FROM [CSH Employees] WHERE (([CSH Employees].status)<>"former") Public Function AgeGroup(DOB As Date) As String Dim intAge As Integer 'Age Calculation intAge = DateDiff("yyyy", [DOB], Now()) + _ Int(Format(Now(), "mmdd") < Format([DOB], "mmdd")) Select Case intAge 'For each Age range, write out Age Group (used in qry) CaseIs < 30 AgeGroup = "<30" Case 30 to 44 AgeGroup = "30-44" Case 45 to 59 AgeGroup = "45-59" Case Is > 59 AgeGroup = "60+" End Select End Function
Syntax error (missing operator) in query expression '(([CSH Employees].status)<>"form er")
Public Function AgeGroup(DOB As Date) As String
Dim intAge As Integer
'Age Calculation
intAge = DateDiff("yyyy" , [DOB], Now()) + _
Int(Format(Now( ), "mmdd") < Format([DOB], "mmdd"))
What am I missing or doing wrong?
Comment