【问题标题】:MS Access 2010 Module Case StatementMS Access 2010 模块案例声明
【发布时间】:2017-07-13 14:10:18
【问题描述】:

我正在尝试在 MS Access 2010 中为生日 = 5/5/1958 执行以下功能,并获得“未知”而不是“狗”的返回值。对这个 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

谢谢!

【问题讨论】:

    标签: ms-access vba select-case


    【解决方案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 中有错误条件。

    【讨论】:

      猜你喜欢
      • 2013-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多