By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,706 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,706 IT Pros & Developers. It's quick & easy.

Do I use Nz

P: n/a
I have a report with 2 sub reports on it. I am grabbing 2 totals from the sub
reports for the main report footer. If there is data in each sub report no
problem. However if one contains nothing I get error. I have been trying to use
Nz to force a zero without success.
This is what I have in the control source of a text box on the main report

=Nz([invoicesubsundriesrpt].[Report]![totsuns])

Any thoughts ?
David B
Hexham UK

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
You could populate the text box that shows the total by using the On Format
event of the section in which it exists eg.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim total as Currency

If Me![invoicesubsundriesrpt].[Report].HasData then
total = Me![invoicesubsundriesrpt].[Report]![totsuns]
End If
Me![txtTotal] = total
End Sub

Using the HasData test avoids an error if the [totsuns] text box does not
exist.

HTH,
Ian.

"David B" <da***@marleycotenospam.fsnet.co.uk> wrote in message
news:br**********@newsg3.svr.pol.co.uk...
I have a report with 2 sub reports on it. I am grabbing 2 totals from the sub reports for the main report footer. If there is data in each sub report no problem. However if one contains nothing I get error. I have been trying to use Nz to force a zero without success.
This is what I have in the control source of a text box on the main report

=Nz([invoicesubsundriesrpt].[Report]![totsuns])

Any thoughts ?
David B
Hexham UK

Nov 12 '05 #2

P: n/a
Brilliant. Many thanks
David B
Ian Hinson <pp******@bigpond.net.au> wrote in message
news:EL******************@news-server.bigpond.net.au...
You could populate the text box that shows the total by using the On Format
event of the section in which it exists eg.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim total as Currency

If Me![invoicesubsundriesrpt].[Report].HasData then
total = Me![invoicesubsundriesrpt].[Report]![totsuns]
End If
Me![txtTotal] = total
End Sub

Using the HasData test avoids an error if the [totsuns] text box does not
exist.

HTH,
Ian.

"David B" <da***@marleycotenospam.fsnet.co.uk> wrote in message
news:br**********@newsg3.svr.pol.co.uk...
I have a report with 2 sub reports on it. I am grabbing 2 totals from

the sub
reports for the main report footer. If there is data in each sub report

no
problem. However if one contains nothing I get error. I have been trying

to use
Nz to force a zero without success.
This is what I have in the control source of a text box on the main report

=Nz([invoicesubsundriesrpt].[Report]![totsuns])

Any thoughts ?
David B
Hexham UK



Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.