Ms access If-then-Else语句访问2010

Ms access If-then-Else语句访问2010,ms-access,if-statement,vba,Ms Access,If Statement,Vba,我一直在论坛上寻找答案,但似乎找不到答案。对不起,代码太长了 基本上,我想做的是,如果第一个“if”语句没有返回任何内容,则在“Billing_preadpayment”字段中设置值“$0.00”。目前,如果我运行代码,但没有匹配项,“Billing_Prepayment”字段将变为空白。不知道我错过了什么。我试过了;“”中,空,为空。什么都没起作用 Private Sub AccountID_Change() ' Adds prepaid values to invoice

我一直在论坛上寻找答案,但似乎找不到答案。对不起,代码太长了

基本上,我想做的是,如果第一个“if”语句没有返回任何内容,则在“Billing_preadpayment”字段中设置值“$0.00”。目前,如果我运行代码,但没有匹配项,“Billing_Prepayment”字段将变为空白。不知道我错过了什么。我试过了;“”中,空,为空。什么都没起作用

   Private Sub AccountID_Change()
    ' Adds prepaid values to invoice
      If DLookup("Total_Prepayment", "quePrepayment", "[AccountID] = Forms![frmInvoices]!AccountID And [Billing_Month] = Forms![frmInvoices]!Billing_Month And [Billing_Year] = Forms![frmInvoices]!Billing_Year") = Null Then
        Billing_Prepayment = "$0.00"
      Else
        Billing_Prepayment = DLookup("Total_Prepayment", "quePrepayment", "[AccountID] = Forms![frmInvoices]!AccountID And [Billing_Month] = Forms![frmInvoices]!Billing_Month And [Billing_Year] = Forms![frmInvoices]!Billing_Year")
End If      
End Sub
  If (DLookup("Total_Prepayment", "quePrepayment", "[AccountID] = Forms![frmInvoices]!AccountID And [Billing_Month] = Forms![frmInvoices]!Billing_Month And [Billing_Year] = Forms![frmInvoices]!Billing_Year") & "") = ""