digitalxni
Registered User.
- Local time
- Today, 20:24
- Joined
- Nov 18, 2009
- Messages
- 42
Hey guys,
I'm running the following function from a query:
This works fine except that now I have some empty DoB fields and this is causing a data mismatch in the expression. I've tried using 'is not null' in the query and a If is not null in the function but none of this is working. Does anyone have any ideas?
I'm running the following function from a query:
Code:
Public Function AgeGroup(DoB As Date) As String
Dim intAge As Integer
intAge = DateDiff("yyyy", [DoB], Now()) + Int(Format(Now(), "mmdd") < Format([DoB], "mmdd"))
Select Case intAge
Case Is < 1
AgeGroup = "A) Under 1"
Case 1
AgeGroup = "B) 1 Year"
Case 2
AgeGroup = "C) 2 Years"
Case 3
AgeGroup = "D) 3 Years"
Case 4
AgeGroup = "E) 4 Years"
Case Else
AgeGroup = "N/A"
End Select
End Function
This works fine except that now I have some empty DoB fields and this is causing a data mismatch in the expression. I've tried using 'is not null' in the query and a If is not null in the function but none of this is working. Does anyone have any ideas?