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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with calc in module w/variables in different rpts

Status
Not open for further replies.

mongous

Technical User
Jun 18, 2002
116
US
I am needing to come up with a percentage calculation. My report pulls the data from one main report and has three nested subreports. The final value will differ, based on one of the variables (referred to as 'Team', but boils down to location) which can be found in one of the subreports.

Code:
Public Function Percentage(ByVal DCA As Integer, ByVal Team As String) As Double



Dim SiteDCA As Integer


    Select Case Team
        Case "BHM Lisa"
            SiteDCA = Reports![rptRepStats_MTDReport]![subCSCDCAs]![BhmDca]
            
        Case "CSC Barbara", "CSC Carly", "CSC Judy", "CSC Leah", "CSC Steve"
            SiteDCA = Reports![rptRepStats_MTDReport]![subCSCDCAs]![SeaDca]
            
        Case "CSC Deanne"
            SiteDCA = Reports![rptRepStats_MTDReport]![subCSCDCAs]![MyghcDca]
            
        Case "CW CS Agents"
            SiteDCA = Reports![rptRepStats_MTDReport]![subCSCDCAs]![CwaDca]
            
        Case "SPO CS Agents"
             SiteDCA = Reports![rptRepStats_MTDReport]![subCSCDCAs]![SpkDca]
             
        Case Else
            MsgBox "Cannot locate team", 0, "Team Error"
    End Select
    
  Reports![rptRepStats_MTDReport].txtPct = DCA / SiteDCA
  
  

End Function

The basic expression is: DCA/SiteDCA

Seems simple, but the value of SiteDCA is dependant on the value of "Team", such as the Select Case statement.

Thanks in advance for any help you can offer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top