Nz Function

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
 
J

Jeff Boyce

Try

varResult = Nz(ctl.Value) , 0)

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

Good luck

Jeff Boyce
<Access MVP>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top