Ms access 如何识别对象是否持有空值
我在引用基础表的表单文本框上有一个控件。我希望有一个命令,在单击时将空值更新为未启动的值。单击后,我得到一条运行时错误消息424-Object-neededMs 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
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=未启动