GroupKeepTogether in code? I need some ideas

Benjamin Bolduc

Registered User.
Local time
Today, 05:25
Joined
Jan 4, 2002
Messages
169
Hi Everyone,

I have a report that needs to open with the Product.GroupKeepTogether property in the sorting and grouping section either true or false. This would depend on a toggle switch on the form that opens it. I can't seem to find out how to do this in code. I figured I could just do a simple If-Then statment in the reports OnOpen event.

Somthing like:

If Forms![Prod Sched (BP)]![Toggle] = 1 Then
'KeepTogether property for [Product] in the sorting and grouping section' = True

Else
'KeepTogether property for [Product] in the sorting and grouping section' = False

End If
End Sub

Lol, I wish it were this easy. Does anyone have any insights on how I can make this happen?

Thanks!
-Ben
 
Not totally sure but it's something along these lines:

Application.Reports("YourReportName").GroupLevel(0).KeepTogether = False

Your first group level = "0" and so on...



Dan
 
The Attachment has grouping set in the On_Open event of the reports. It is set by the radio buttons on the form.
 

Attachments

That's actually a really nice form OldSoftBoss, but I can't seem to find a way of manipulating the group keeptogether property on it.

Basically, I just want to be able to toggle between having the report show all of the [Product] groups on the same page or having them split onto seperate pages.

I appreciate your help, and will look forward to your reply :)

-Ben
 
From A2000 help.....

searched for keeptogether


Grouping Properties Example

The following example sets the SortOrder and grouping properties for the first group level in the Products By Category report to create an alphabetical list of products.

Private Sub Report_Open(Cancel As Integer)
' Set SortOrder property to ascending order.
Me.GroupLevel(0).SortOrder = False
' Set GroupOn property.
Me.GroupLevel(0).GroupOn = 1
' Set GroupInterval property to 1.
Me.GroupLevel(0).GroupInterval = 1
' Set KeepTogether property to With First Detail.
Me.GroupLevel(0).KeepTogether = 2
End Sub


HTH
Dave
 

Users who are viewing this thread

Back
Top Bottom