Vba IIf在IIf内分配变量值
我试图理解为什么我不能用IIf来给变量赋值Vba IIf在IIf内分配变量值,vba,ms-access,Vba,Ms Access,我试图理解为什么我不能用IIf来给变量赋值 dim i as integer dim j as integer i = 1 j = 2 if i = 1 or iif(j = i, j = 10, j = 20) then msgbox j end if 我知道我可以使用IIf来分配如下变量: j = IIf(1 = 2, 5, 10) 在这种情况下,j等于10。解决方法如下: Dim i As Integer i = 1 Dim j As Integer j = 2 Sel
dim i as integer
dim j as integer
i = 1
j = 2
if i = 1 or iif(j = i, j = 10, j = 20) then
msgbox j
end if
我知道我可以使用IIf来分配如下变量:
j = IIf(1 = 2, 5, 10)
在这种情况下,j等于10。解决方法如下:
Dim i As Integer
i = 1
Dim j As Integer
j = 2
Select Case i
Case 1
'Do nothing
Case j
j = 10
Case Else
j = 20
End Select
MsgBox j
IIf不是这样的,也不是有意的。研究这个问题。