I can't seem to get my code to work. I am trying to attach a procedure ta control on a report.
Basically it is just supposed to come up with a percentage base on two numbers: one within the report and the other within a nested subreport.
The problem is when it is ran, I keep getting prompted for the values of my variables (DCA and SiteDCA). I THOUGHT I declared and set them in my code!?!?!?
Code:
Function Percentage(DCA As Integer, SiteDCA As Integer)
Dim Team As String
Dim Pct As Integer
Team = Reports![rptRepStats_MTDReport]![Team]
DCA = Reports![rptRepStats_MTDReport]![DCA]
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
Pct = DCA / SiteDCA
End Function
Basically it is just supposed to come up with a percentage base on two numbers: one within the report and the other within a nested subreport.
The problem is when it is ran, I keep getting prompted for the values of my variables (DCA and SiteDCA). I THOUGHT I declared and set them in my code!?!?!?