我正在尝试使用 aSelect Case
来评估TempVar
字符串值,但这种情况并没有给我正确的结果。
到目前为止我的 VBA 代码:
Private Sub Form_Load()
Select Case TempVars!CurrentStatus
Case Entered
'code to disable some controls
Case In Progress
'code to disable some controls
Case Ready to Approve
'code to disable some controls
Case Approved
'code to disable some controls
Case Else
Call MsgBox("Case statement didn't catch", vbInformation, "Tempvar test for case statements")
End Select
End Sub
以TempVar
另一种形式设置如下:
Dim StrUserInput1 As String
TempVars("CurrentStatus").Value = DLookup("Status", "Control", "Status = '" & StrUserInput1 & "'")
'This is set by comparing the user input vs allowed status (for reports which is yet to be implemented)
我试过设置Case
asCase "Entered"
但它总是选择第一种情况,而不是正确的情况。如果它的格式如上所示,结果是Case Else
谁能提供一些关于我为什么或如何没有得到正确结果的见解?