我正在尝试在MS Access 2010 for Birthday = 5/5/1958中执行以下功能,并获得返回值“unknown”而不是“Dog”。有关此CASE声明的任何帮助吗?
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
谢谢!
答案 0 :(得分:1)
试试这个:
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
在您的情况下,您在Select Case
中有错误的条件。