请教:z = NULL
IF z = NULL then
   P1...
endif为什么有时候程序不执行p1

解决方案 »

  1.   

    Dim z
     z = Null
     If IsNull(z) Then
        MsgBox "s"
     End If
      

  2.   

    Null是 Variant 子类型,用来说明数据项没有包含合法的数据。
    Dim intVal As Integer
    Dim strVal As String
    Dim vntVal As Variant
    intVal = Null 'Error
    strVal = Null 'Error
    vntVal = Null 'Ok
    要判断某个变量是否为Null,不能使用“=”进行判断,因为Null不等于任何值,包括Null值。
    使用IsNull函数进行判断
    若函数返回值为True,则变量的值为Null,
    若函数返回值为False,则变量的值不为Null。