thanks Gord, I tested your code. It does not work, I am passing the dob as parameter and I tried exactly what you suggested. If I put me in front of it, I get an syntax error and without it does not display the message. It does work when you have on a form, but I am testing the value that is on a table, I passed the value as parameter, is there any othe way. thank you Gord, I am been trying for days now different combinations and it does not seem to work. any other suggestinos. I really appreciate it .
Here is my function Gord, maybe you can tell why I can test the dob for null. I tried the is missing function but it does not work either. I am open to any other suggestions.
thank you Gord
Public Function AGECAT(DOB As Date, TREATYNO As String, TYPEHOURS As String) As String
DoCmd.SetWarnings True
Dim lnage As Double
Dim lcagecat As String
lnage = ((lcdate - [DOB]) / 365.25)
If IsMissing(DOB) Then
lcagecat = "no dob"
Else
If (lnage > 0 And lnage <= 3.6) Then
lcagecat = "0 - Infant (0-3.5 yrs)"
End If
If (lnage > 3.6 And lnage <= 5.6) Then
lcagecat = "1 - Toddler (3.6-5.5 yrs)"
End If
Public Function AGECAT(DOB As Date, TREATYNO As String, TYPEHOURS As String) As String
DoCmd.SetWarnings True
Dim lnage As Double
Dim lcagecat As String
lnage = ((lcdate - [DOB]) / 365.25)
If (DOB) = #12:00:00 AM# Then '<-Seems to be the value when date is empty.
lcagecat = "no dob"
Else
If (lnage > 0 And lnage <= 3.6) Then lcagecat = "0 - Infant (0-3.5 yrs)"
If (lnage > 3.6 And lnage <= 5.6) Then lcagecat = "1 - Toddler (3.6-5.5 yrs)"
End If
AGECAT = lcagecat
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.