Query - Adding

  • Thread starter Thread starter Pass-the-reality
  • Start date Start date
P

Pass-the-reality

I have a field [Claims] and a field [Executed] In my query I want to divide
the two so I created
ExecutedPercent:Format([Claims]/[Executed],"Percent") My problem is if data
in claims is blank and the data in executed blank, my ExecutedPercent is
blank. How can my ExecutedPercent to show zero?
 
ExecutedPercent:Format(Nz([Claims],0)/Nz([Executed],1),"Percent")

The Nz function will return the value of the second argument if the value of
the first argument is Null. In this case, you want to convert Claims to 0,
but if you convert Executed to 0 and it had a Null value, you would get a
divide by zero error. Converting it to 1 will cause it to divide Claims by 1
which will return the value of Claims.
 
Back
Top