if trim({glvoucher.CURRacct})<>""
or trim({glvoucher.acctype})="3"
or trim({glvoucher.acctype})="4" 
or trim({glvoucher.acctype})="9" 
or trim({glvoucher.acctype})="10" then
"Y"
ELSE
"N"
好奇怪,
if trim({glvoucher.CURRacct})<>""
or trim({glvoucher.acctype})="3"
这样写的时候,3满足都出不来
但是if  trim({glvoucher.acctype})="3"
or trim({glvoucher.CURRacct})<>""
换个顺序,两个条件下都可以出来
请问是怎么回事~
谢谢

解决方案 »

  1.   

    用来对两个表达式进行逻辑析取运算。语法result = expression1 Or expression2Or 运算符的语法具有以下几个部分:部分 描述 
    result 必需的;任何数值变量。 
    expression1 必需的;任何表达式。 
    expression2 必需的;任何表达式。 
    说明如果两个表达式中至少有一个为 True,则 result 为 True。下列表格说明如何确定 result:如果 expression1 为 且 expression2 为 则 result 为 
    True True True 
    True False True 
    True Null True 
    False True True 
    False False False 
    False Null Null 
    Null True True 
    Null False Null 
    Null Null Null 
    Or 运算符也对两个数值表达式中位置相同的位进行逐位比较,并根据下表对 result 中相应的位进行设置:如果在 expression1 的位为 且在 expression2 中的位为 result 为 
    0 0 0 
    0 1 1 
    1 0 1 
    1 1 1 
      

  2.   

    我输入3的时候,执行下面
    if trim({glvoucher.CURRacct}) <>"" 
    or trim({glvoucher.acctype})="3" 但是结果不是"y"我输入3的时候或者令trim({glvoucher.CURRacct}) 为空,执行下面
    if  trim({glvoucher.acctype})="3" 
    or trim({glvoucher.CURRacct}) <>"" 都可以执行"Y"
      

  3.   

    看起来是很奇怪,难道or比<>的优先级还高不成?
      

  4.   

    trim({glvoucher.CURRacct}) <>"" 包含了trim({glvoucher.acctype})="3" 
      

  5.   

    我试了,也是正确的。=================================
    另:楼主的代码有逻辑问题。
    If strTest <> "" Or strTest = "3" Or strTest = "4" Or strTest = "9" Or strTest = "10" Then
        Debug.Print = "Y"
    Else
        Debug.Print "N"
    End If红色文字部分是画蛇添足。
    ^_^