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!

Printing the field value in a report's subtotal line

Status
Not open for further replies.

wyld

Programmer
Apr 23, 2001
28
US

I have a report that has 3 different sort options (claim number, ppo, or group) based on what radio button is selected on a form. The report does subtotals based on what option is selected. Currently, the report say 'Subtotal' on the subtotal line for all of the sort options.

How can I get it to either print the sort option (claim number, ppo, or group) or the value of the control break? For example, if the report is sorted on group number and the total is for group 999, the subtotal line would say:
Group Subtotal etc...
or
999 Subtotal etc...

Thanks in advance!
 
You can look at the form to see the value selected and use an iif statement combined with concatenation of "SubTotal" to return the proper caption. I've made some assumptions to show you the code, change to suit your environment.

Assumptions
optSortGroup = name of control holding Sort Radio Buttons
Claim Number = value of 1 in optSortGroup
PPO = value of 2 in optSortGroup
Group =[/b] value of neither 1 or 2 in optSortGroup


Code in control for SubTotal caption:
[tt]
=IIf([Forms]![MyFormName]![optSortGroup]=1,"Claim Number",IIf([Forms]![MyFormName]![optSortGroup]=2,"PPO","Group")) & " SubTotal"
[/tt]

Hope that helps! Joe Miller
joe.miller@flotech.net
 
After posting this I realize I made a mistake in that you wanted to show the record name when "Group" is selected, for this all you have to do is change my code to this:

[tt]
=IIf([Forms]![MyFormName]![optSortGroup]=1,"Claim Number",IIf([Forms]![MyFormName]![optSortGroup]=2,"PPO",[GroupNameField])) & " SubTotal"
[/tt]

[GroupNameField] = the field holding "999" in your example
Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top