Nz Function

  • Thread starter Thread starter Administrator
  • Start date Start date
A

Administrator

I have a report that lists Adult, child, Sr Citizen,
Special, Season Pass. If there are any tickets sold, it
gives me an amount. However, if tickets were not sold,
it's a null value and my totals won't add. I have added
the Nz Function to the OnOpen of my Report, however,
obviously I'm doing something wrong. Help.

Public Sub CheckValue()

Dim rpt As Form
Dim ctl As Control
Dim varResult As Variant

Set rpt = Report!RPTOS
Set ctl = frm![Special]
varResult = IIf(Nz(ctl.Value) = 0, "0")

End Sub
 
Try

varResult = Nz(ctl.Value) , 0)

to set varResult = 0 (zero) when ctl.Value is null

Good luck

Jeff Boyce
<Access MVP>
 
Back
Top