如果/然后声明问题

时间:2019-05-07 15:23:44

标签: ms-access access-vba

我有一个if / then语句,它将根据拍子操作号打开一个表单。问题是,我最近遇到了一个问题,有些人没有拍子动作号码。如果没有拍拍操作编号,如何构架此代码,以便根据位置编号打开表格。

If Me.txtPATS <> "" Then
    If Me.Action_Type <> "Job Opening" Then
        DoCmd.OpenForm "sfrmPAR", , , "PATS_ActionID=" & Me.PATS_ActionID,    acFormEdit
    End If
    If Me.Action_Type = "Job Opening" Then
        DoCmd.OpenForm "sfrmPARVacancy", , , "PATS_ActionID=" & Me.PATS_ActionID, acFormEdit
    Else
        DoCmd.OpenForm "sfrmPAR", , , "[Position_ #]='" & Me.txtPos & "'", acFormEdit
    End If
    If txt.PATS = Null Then
        DoCmd.OpenForm "sfrmPARVacancy", , , Action_Type = " & Me.Action_Type, acFormEdit"
    End If
End If

1 个答案:

答案 0 :(得分:0)

类似的东西:

If Nz(Me!txtPATS.Value) <> "" Then
    If Me.Action_Type <> "Job Opening" Then
        DoCmd.OpenForm "sfrmPAR", , , "PATS_ActionID=" & Me.PATS_ActionID, acFormEdit
    End If
    If Me.Action_Type = "Job Opening" Then
        DoCmd.OpenForm "sfrmPARVacancy", , , "PATS_ActionID=" & Me.PATS_ActionID, acFormEdit
    Else
        DoCmd.OpenForm "sfrmPAR", , , "[Position_ #]='" & Me.txtPos & "'", acFormEdit
    End If
    If IsNull(txt.PATS) Then
        DoCmd.OpenForm "sfrmPARVacancy", , , Action_Type = " & Me.Action_Type, acFormEdit"
    End If
End If