bjk
bjk

Reputation: 43

If then Else Statement Access 2010

I have been scouring through the forum looking for an answer and I can't seem to find one. Sorry for the length of code!

Basically, what I want looking to do is set the value of "$0.00" in the "Billing_Prepayment" field if the first "if" statement returns nothing. Currently, if I run the code, and there are not matches, the "Billing_Prepayment" field goes blank. Not sure what I am missing. I have tried; "", Null, Isblank. Nothing has worked.

   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

Upvotes: 0

Views: 590

Answers (1)

kiks73
kiks73

Reputation: 3758

  If (DLookup("Total_Prepayment", "quePrepayment", "[AccountID] = Forms![frmInvoices]!AccountID And [Billing_Month] = Forms![frmInvoices]!Billing_Month And [Billing_Year] = Forms![frmInvoices]!Billing_Year") & "") = ""

Upvotes: 1

Related Questions