Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove #Error when calculating FROM a subform

Status
Not open for further replies.

ArffMarine

Technical User
Jan 20, 2004
23
0
0
US
Anyhting that is in quotes ("") is the control source for the specified text box or the name of a form or table.

We are using Microsoft Access to calculate teaching hours for instructors at our academy.
For each class taught, there are two instructors assigned. These instructors are titled Primary Instructor and Alternate Instructor.

The form “classcount” has two subforms “classcountAlternate” and “classcountprimary”. “Classcountprimary” returns the number of every class the Instructor has taught as the primary and “classcountAlternate” returns the number of every class the Instructor has taught as the Alternate. Each of the subforms has 2 calculated textboxes. One counts the number of records returned on each form "=count([class #])", the other multiplies the return by 144 to get the total hours taught. "=[Text2]*144"". The data all comes from the same table ”Class Info”.

On the mainform are two text boxes that return the value of the total hours taught from the subforms "=ClassCountPrimary.Form!Text6" and “ClassCountAlternate.Form!Text6" These two textboxes are then added together to get the overall sum of hours taught “=[text01]+[text02]”

The problem I have is if the instructor hasn’t taught any classes as the primary or as the alternate, the respective subform returns no records and I get #Error as a result.

Is there a way to eliminate this?

I have heard of the Nz function but have NO idea how it works.

Thanks in advance.

ArffMarine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top