473,382 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Report/Subreport Problem

I am using a command button from a form (Access 2000) to produce a report. The form and the report each have a subform (subreport). Here is the expression that produces a total for one field on the report.

=nz([Tech Assist Subreport]![Total Service Hours])+nz([CaseLaw Updates Hours])+nz([DefenseNET Newsletter Hours])+nz([Defense Magazine Hours])+nz([Brief Bank Hours])+nz([Other Publication Hours])+nz([Amicus Hours])+nz([Training Performed Hours])+nz([Training Attended Hours])+nz([Administration Hours])+nz([Collaboration Hours])

This expression works perfectly as long as there is a value for the [Tech Assist Subreport]![Total Service Hours])

If [Tech Assist Subreport]![Total Service Hours]) has no value, that subreport is blank on the report and the total expression results in "Error"

I have also tried this expression:

=IIf(IsNull([Tech Assist Subreport]![Total Service Hours]),nz([CaseLaw Updates Hours])+nz([DefenseNET Newsletter Hours])+nz([Defense Magazine Hours])+nz([Brief Bank Hours])+nz([Other Publication Hours])+nz([Amicus Hours])+nz([Training Performed Hours])+nz([Training Attended Hours])+nz([Administration Hours])+nz([Collaboration Hours],nz([Tech Assist Subreport]![Total Service Hours])+nz([CaseLaw Updates Hours])+nz([DefenseNET Newsletter Hours])+nz([Defense Magazine Hours])+nz([Brief Bank Hours])+nz([Other Publication Hours])+nz([Amicus Hours])+nz([Training Performed Hours])+nz([Training Attended Hours])+nz([Administration Hours])+nz([Collaboration Hours])))

Same error is produced. Any ideas are appreciated!
Jun 19 '07 #1
3 2373
MMcCarthy
14,534 Expert Mod 8TB
You are using the nz function but you are not giving a value to be substituted if null.

the nz function is ...

nz(Expression, value if null)

Try this ...

=nz([Tech Assist Subreport]![Total Service Hours], 0) + nz([CaseLaw Updates Hours], 0) + nz([DefenseNET Newsletter Hours], 0) + nz([Defense Magazine Hours], 0) + nz([Brief Bank Hours], 0) + nz([Other Publication Hours], 0) + nz([Amicus Hours], 0) + nz([Training Performed Hours], 0) + nz([Training Attended Hours], 0) + nz([Administration Hours], 0) + nz([Collaboration Hours], 0)
Jun 20 '07 #2
dima69
181 Expert 100+
I'm sorry I have to contradict our Administrator ): but this is not the problem of NZ function.
The problem is that SubReport works differently from SubForm, meaning that when there is no data in subreport, it behaves like it dosn't exist at all (from the point of view of the main report), so any reference to subreport with no data will produce an error.
My solution for this is to create a function in the main form module, wich will return the required value from the subreport.
This function should include error handling, returning 0 on error.
Jun 20 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
I'm sorry I have to contradict our Administrator ): but this is not the problem of NZ function.
The problem is that SubReport works differently from SubForm, meaning that when there is no data in subreport, it behaves like it dosn't exist at all (from the point of view of the main report), so any reference to subreport with no data will produce an error.
My solution for this is to create a function in the main form module, wich will return the required value from the subreport.
This function should include error handling, returning 0 on error.
My sincere apologies, I missed this entirely. Must have been tired when I was doing this (LOL).

Dima is of course right, thanks for the pick up.
Jun 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Steve Edwards | last post by:
I have a database that is used for tracking customer survey data. Each customer can have multiple products. I have a report that lists customers that have not yet been surveyed...
6
by: David B | last post by:
I have a report with 2 sub reports on it. The report is an invoice and the sub reports are dropping data onto the invoice. This worked fine if generating 1 invoice at a time. I am trying to create...
4
by: Mark Reed | last post by:
Hi Guru's, Hopefully I can explain this OK.....What I am trying to do is create a QC check sheet using the following fields: ASN, PO & Qty. This information will be at the top of each report with...
7
by: Ellen Manning | last post by:
I've got an A2K report showing students and their costs. Student info is in the main report and costs are in a subreport for each student. The user inputs the program desired then only those...
4
by: Trevor Best | last post by:
I have a report that's fairly simple, page headers and footers, detail has a subreport in (can vary in length). The customer wanted a signature block for them, their client and 3rd party. This was...
3
by: lorirobn | last post by:
Hello, I have a report which uses a subreport. When I run the report, I get "Enter Parameter Value" error message for "tblGuestRoom". I click ok and the report seems to work fine. I...
8
by: stemo76 | last post by:
I have created a report with subform/subreports. I can see all the data on the screen but when I try to print it to a printer or adobe distiller I get 'The Microsoft Jet Database engine could not...
8
by: | last post by:
hi, i have a form on which a user can choose specific criteria such as dates etc, in order to filter the report that is called from the form. i do this by using the Where section of the...
1
by: Tim Frawley | last post by:
I have created a Crystal Report with five subreports to represent datagrids on our dataentry application. The largest datagrid is the last item on the report. When empty this last subreport will...
2
by: jammer | last post by:
Hey All, I have a report based on a query that joins a 'parent' and 'child' table. Each row in the query corresponds to a row in the child table, with a few fields from the Parent table. At...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.