0

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!

Erik A
  • 31,639
  • 12
  • 42
  • 67
TimoLV
  • 3
  • 2

1 Answers1

1

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.

Vityata
  • 42,633
  • 8
  • 55
  • 100