Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access 如何识别对象是否持有空值_Ms Access_Vba - Fatal编程技术网

Ms access 如何识别对象是否持有空值

Ms access 如何识别对象是否持有空值,ms-access,vba,Ms Access,Vba,我在引用基础表的表单文本框上有一个控件。我希望有一个命令,在单击时将空值更新为未启动的值。单击后,我得到一条运行时错误消息424-Object-needed Private Sub Comando50_Click() If [txtScope] = ("not started") Then [txtScope] = ("proposed") ElseIf [txtScope] = ("proposed") Then [txtScope] = ("accepte

我在引用基础表的表单文本框上有一个控件。我希望有一个命令,在单击时将空值更新为未启动的值。单击后,我得到一条运行时错误消息424-Object-needed

Private Sub Comando50_Click()

  If [txtScope] = ("not started") Then
      [txtScope] = ("proposed")

  ElseIf [txtScope] = ("proposed") Then
      [txtScope] = ("accepted")

  ElseIf [txtScope] Is Null Then
      [txtScope] = ("not started")


  ElseIf [txtScope] = ("accepted") Then
      [txtScope] = ("rejected")


  ElseIf [txtScope] = ("rejected") Then
       [txtScope] = ("on track")

  ElseIf [txtScope] = ("on track") Then
      [txtScope] = ("needs attention")


  ElseIf [txtScope] = ("needs attention") Then
      [txtScope] = ("critical")

  ElseIf [txtScope] = ("critical") Then
      [txtScope] = ("complete")

  ElseIf [txtScope] = ("complete") Then
      [txtScope] = ("not started")

  End If


End Sub

假设txtScope是表单上的文本框或字段,那么您应该这样引用它:

Me.txtScope

我!txtScope

不需要在文本值周围加括号:

Private Sub Comando50_Click()

  If Me.txtScope = "not started" Then
      Me.txtScope = "proposed"    
  ElseIf Me.txtScope = "proposed" Then
      Me.txtScope = "accepted"
'etc etc
End Sub

然而,它仍然没有获取空值。这可能是因为对象实际上来自下拉菜单吗?ElseIf Me.txtScope=Null,则Me.txtScope=未启动