I am trying to perform the following function in MS Access 2010 for Birthday=5/5/1958 and getting a return value of "unknown" instead of "Dog." Any help on this CASE statement?
Public Function whichChineseZodiacSign(Birthday As Date)
Select Case whichChineseZodiacSign
Case #2/18/1958# To #2/7/1959#
whichChineseZodiacSign = "Dog"
Case Else
whichChineseZodiacSign = "Unknown"
End Select
End Function
Thanks!
Try this:
Option Explicit
Public Function whichChineseZodiacSign(Birthday As Date) As String
Select Case Birthday
Case #2/18/1958# To #2/7/1959#
whichChineseZodiacSign = "Dog"
Case Else
whichChineseZodiacSign = "Unknown"
End Select
End Function
In your case you had false condition in the Select Case
.