Computer Science & Engineering 2111 CSE 2111 Lecture NZ Function 1CSE 2111 NZ Function
ClientPayments Let’s take a closer look at the PaymentsByClient Query….in an outer join with respect to Clients, when a record from Clients doesn’t have any matching records in Payments, it’s included in the results, but the fields that would have come from Payments are NULL. CSE 2111 NZ Function2
Access doesn’t know what $100 – NULL is, so it returns NULL as the result. But we know that in this case, NULL should be treated like zero – can we help Access out? CSE 2111 NZ Function3
NZ Function Syntax: Nz(variant, value_if_null) If this argument evaluates to NULL…. Return this value If the variant argument does NOT evaluate to NULL, Nz will return whatever the variant argument does evaluate to. CSE 2111 NZ Function4
BalanceDue Tables: PaymentsByClient,ChargesByClient Join On: ClientIDJoin Type: Inner Field: ClientIDFirstNameLastNameSumOfAmount Balance* Table: PaymentsBy Client ChargesBy Client Total: Sort: Show: XXXXXX Balance: Nz([Charges]![SumOfAmount],0) – Nz([Payments]![SumOfAmount],0) Balance Due with the Nz function….. CSE 2111 NZ Function5
Finally! CSE 2111 NZ Function6