如果在VBA访问

问题描述 投票:0回答:1

嗨伙计们,我在下一个代码遇到问题:

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如果有什么想法我可以检查或更改?

感谢您的关注。

vba ms-access if-statement
1个回答
1
投票

删除End Ifs。看看语法,可能是herehere

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
© www.soinside.com 2019 - 2024. All rights reserved.