[英]MS Access 2010 Module Case Statement
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."我试图在 MS Access 2010 中为生日 = 5/5/1958 执行以下功能,并获得“未知”而不是“狗”的返回值。 Any help on this CASE statement?对这个 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
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
.在您的情况下,您在Select Case
有错误条件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.