验证是否存在特定值然后在其他列中不应为null

时间:2017-09-18 11:31:16

标签: vba access-vba

我有两列,如果pricesource列的值类似'先前值'且PO_DATE列有空,那么我必须显示消息“它有空”,我尝试了一些像这样,但没有得到适当的输出。纠正我

Dim rst As Recordset
Set rst = db.OpenRecordset("select pricesource from [Input Norm] where pricesource='Prior File'")
If rst And IsNull(PO_DATE) Then
MsgBox "PO_DATE HAS NULLS, Please check"
End If

1 个答案:

答案 0 :(得分:0)

您可以使用:

Dim rst As Recordset

Set rst = db.OpenRecordset("select PO_DATE from [Input Norm] where pricesource='Prior File'")
If rst.RecordCount > 0 Then
    If IsNull(rst!PO_DATE.Value) Then
        MsgBox "PO_DATE has Nulls, please check."
    End If
End If
rst.Close

Set rst = Nothing