Urgent! Changing a Group in a Crystal Report at Runtime

ellebanna
04-19-2004, 12:55 PM
I am able to change the group field at runtime but the Running totals are not reflecting the change, how do you do this?

Code to change the group field:
Sub ChangeGroup(ActualSort, SortOrder, Xviewer)
Dim Fld, CountFld As Integer
Dim S As String
CountFld = CRReport.RecordSortFields.Count
For Each SortField In CRReport.RecordSortFields
If ActualSort = SortField.Field.Name Then
Set NewSortfld = SortField
Set SortField = CRReport.RecordSortFields(1)
SortField.Field = NewSortfld.Field
CRReport.Areas.Item("GH").GroupConditionField = SortField.Field

If SortOrder = "Ascending" Then
CRReport.Areas.Item("GH").SortDirection = crAscendingOrder
Else
CRReport.Areas.Item("GH").SortDirection = crDescendingOrder
End If
Exit For
End If
Next

Xviewer.ViewReport
End Sub

MKoslof
04-19-2004, 12:58 PM
What do you mean the running total fields are not changed? Are they no longer calculating? What error are you getting? How have you defined your running total fields. These running total fields actually are bound to your group. If you destroy the group, these running total are destroyed too.

ellebanna
04-19-2004, 01:02 PM
What do you mean the running total fields are not changed? Are they no longer calculating? What error are you getting? How have you defined your running total fields. These running total fields actually are bound to your group. If you destroy the group, these running total are destroyed too.
The report i am basing is originally grouped say by District, in the report, the running total is set to reset onChange of group. If i change the Group field to say"Provider", the Running total is not reflecting the new group field

MKoslof
04-19-2004, 01:03 PM
Right, because it has no relation to "Provider" :). I have never played with creating dynamic running totals...though I am sure it is possible. If you have a running total field bound to "District" and then you change your grouping to use "Provider", the running total has nothing to go by.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum