# Calculation on Report using SubReport (1 Viewer)

#### Vergy39

##### Registered User
I have a main report that shows an associates peices per hour worked (PPH). The associate is rated based on a scale that is determined by the departments average PPH. I have created the scale as a subreport on the main report. Example of scale= Associate receives a rating of 3 if their pph is >= to .4987, receives a rating if 2 if their pph is between .4206 and .4986, receives a rating of 1 if their pph is between .3252 and .4205, and a rating of 0 if their pph is below .3251. Ihave a text box on the main report that has the following string:

=IIf([AccessTotalsAvePPH1]>=([Report.Qry_QuantityScale.3Rating]),"3",IIf([AccessTotalsAvePPH1]>=([Report.Qry_QuantityScale.2Rating]),"2",IIf([AccessTotalsAvePPH1]>=([Report.Qry_QuantityScale.1Rating]),"1",IIf([AccessTotalsAvePPH1]<=([Report.Qry_QuantityScale.0Rating]),0))))

The subreport is called Qry_QuantityScale. the report has fields listed as 3Rating, 2Rating, 1Rating and 0Rating. When I replace the "report.Qry_QuantityScale.3Rating" with the actual numbers in the fields of the Qry_QuantityScale report, the text box returns the correct rating number. The current string gets a "#Name" error. Any assistance is greatly appreciated.

Thanks
Happy Holidays
David V.

#### boblarson

1. make sure you are referring to the subreport CONTROL (control on the main report which HOUSES the subreport - not necessarily the subreport name unless they share the name).

2. I've found that using this method makes it simple to ensure I have the correct syntax.
(the example shows forms and subforms but the concept is the same for reports and subreports)

#### Vergy39

##### Registered User
Thanks Bob, I tried this and this makes sense. However, I am still getting an error. It is now the error "#Type". Not sure why this is happening.

Thanks
David V.