【问题标题】:If In VBA Access如果在 VBA 访问
【发布时间】:2019-02-08 18:05:24
【问题描述】:

大家好,我在使用下一个代码时遇到问题:

Private Sub btnRegistrar_Click()


    If IsNull(txtNumeroActa) Then
        MsgBox "Ingresar Número de Acta"
        Me.txtNumeroActa.SetFocus
    End If
    ElseIf IsNull(txtNumeroActa) Then
        MsgBox "Ingresar NIT"
        Me.txtNumeroActa.SetFocus
    End If
    ElseIf IsNull(txtNumeroActa) And IsNull(txtNumeroActa) Then
        MsgBox "Ingresar Número de Acta y NIT"
        Me.txtNumeroActa.SetFocus
        Me.txtNumeroActa.SetFocus
    End If

End Sub

当我运行它时,出现一条错误消息:Else without If any idea of​​ a what I can check or change?

感谢您的关注。

【问题讨论】:

标签: vba ms-access if-statement


【解决方案1】:

删除结束如果。看看语法,可能是here 或者here

If IsNull(txtNumeroActa) Then
    MsgBox "Ingresar Número de Acta"
    Me.txtNumeroActa.SetFocus
ElseIf IsNull(txtNumeroActa) Then
    MsgBox "Ingresar NIT"
    Me.txtNumeroActa.SetFocus
ElseIf IsNull(txtNumeroActa) And IsNull(txtNumeroActa) Then
    MsgBox "Ingresar Número de Acta y NIT"
    Me.txtNumeroActa.SetFocus
    Me.txtNumeroActa.SetFocus
End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    • 2015-07-14
    • 2016-08-23
    相关资源
    最近更新 更多