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

Dynamic Cross Tab w/ %of Grand Total

Status
Not open for further replies.

tomlawrence

Programmer
Sep 29, 2001
2
US
I have a dynamic crosstab report very similar to the employee sales report in the solutions.mdb. Using the employee report as an example, I would like to add a percent of total under the report totals for each Employee. In other words, what percent of the total sales does this employees sales account for. Is their a way to do that programmaticaly? Of course, if I hard code the calc on the the report I get errors if that column is not used because of inactivity. Obviously, I will always have a total sales column and I know where it's going to be on the report. Any insight would be much appreciated.

Tom
 
Much the same way you did the Dynamic report.

At the report footer, add as manu colums as are going to be needed. Name them txtSum1, txtSum2, txtSum3 Etc.

Here's some code I use in one of my DBs:

Code:
For i = 0 To IntColCount - 1 'Number of columns
    'Set the recodsource for the fields
    strName = rst.Fields(i).Name
    'Set the title of the label
    Me.Controls("txtdata" & i).ControlSource = strName
    Me.Controls("txtSum" & i ).ControlSource = "=sum([" & strName & "])"
Next i
For i = IntColCount 0 To 12
    'Make the rest of the controls invisible
    Me.Controls("txtData" & i).Visible = False
    Me.Controls("lblMos" & i).Visible = False
    Me.Controls("txtSum" & i).Visible = False
Next i
Tyrone Lumley
augerinn@gte.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top