I have a set of reports with running time ranging from half a minute to 2 minutes. Another set of reports takes only 15 to 20 seconds and both sets are using the same query (tried query of linked tables and pass-thru query, there's not much difference). The reports have sorting and grouping in 3 different fields. The report values are populated by assigning values to control sources such as below:
prd1Act.ControlSource = "=Sum(IIf([TIME] ='" & gstrPrd & " ',[AMT],0))"
prd1Bgt.ControlSource = "=Sum(IIf([TIME] ='" & gstrPrd & " ',[AMT],0))"
prd1Var.ControlSource = "=[p1Bgt]-[p1Act]"
prd1VarP.ControlSource = "=iif([p1Bgt]<>0,([p1Bgt]-[p1Act])/[p1Bgt],0)"
toDate1Act.ControlSource = "=Sum(IIf([PERIOD]<=" & gintPrd & ",[AMT],0))"
toDate1Bgt.ControlSource = "=Sum(IIf([PERIOD]<=" & gintPrd & ",[AMT],0))"
toDate1Var.ControlSource = "=[b1Bgt]-[b1Act]"
toDate1VarP.ControlSource = "=iif([b1Bgt]<>0,([b1Bgt]-[b1Act])/[b1Bgt],0)"
The 1 in prd1/todate1 indicates the group. Since budget figures are not available at the moment, Bgt picks up the Actual for illustration purposes only.
Question: Is there a more efficient way of coding the report?
Greatly appreciate your thoughts.
prd1Act.ControlSource = "=Sum(IIf([TIME] ='" & gstrPrd & " ',[AMT],0))"
prd1Bgt.ControlSource = "=Sum(IIf([TIME] ='" & gstrPrd & " ',[AMT],0))"
prd1Var.ControlSource = "=[p1Bgt]-[p1Act]"
prd1VarP.ControlSource = "=iif([p1Bgt]<>0,([p1Bgt]-[p1Act])/[p1Bgt],0)"
toDate1Act.ControlSource = "=Sum(IIf([PERIOD]<=" & gintPrd & ",[AMT],0))"
toDate1Bgt.ControlSource = "=Sum(IIf([PERIOD]<=" & gintPrd & ",[AMT],0))"
toDate1Var.ControlSource = "=[b1Bgt]-[b1Act]"
toDate1VarP.ControlSource = "=iif([b1Bgt]<>0,([b1Bgt]-[b1Act])/[b1Bgt],0)"
The 1 in prd1/todate1 indicates the group. Since budget figures are not available at the moment, Bgt picks up the Actual for illustration purposes only.
Question: Is there a more efficient way of coding the report?
Greatly appreciate your thoughts.