一开始是一个简单的验证代码,在我看来,它转换成非常自相矛盾的东西。
以下代码返回“干得好!” 当我在 InputBox 弹出窗口中输入负数时
Dim myvar As String
myvar = InputBox("input a positive number, please")
If IsNumeric(myvar) Then
myvar = CDbl(myvar)
Select Case myvar
Case Is < 0
MsgBox "I need a positive number"
Exit Sub
Case Is > 0
MsgBox "Good work!"
[MyField] = myvar
RunCommand acCmdSaveRecord
Me.Requery
Exit Sub
Case Else
MsgBox "You entered '" & myvars & "'. I don't know what to do about"
End Select
Else
MsgBox "A Number, please"
End If
这真的是验证 InputBox 的最佳方式吗?