Group By - code

Oldsoftboss

AWF VIP
Local time
Tomorrow, 02:03
Joined
Oct 28, 2001
Messages
2,499
Is it possible to force the sort by (group by) through code?
I have 1 report that I would like the data to sometimes be displayed by date, sometimes by customer, sometime by town or postcode.
At the moment I have 4 identical reports, based on the same query, with different Group By's in each reports setup. I tried to manipulate the orderby in the reports record source but the it still displayed in the order set in the Grouping.
Any help much appreciated.
Dave
 
I haven't tested it out, but maybe this is something you could use (I found it as I was scrounging around on the web for a downloadable DB of the English dictionary - just the words, actually, not that this has anything to do with report grouping - I digress):

http://www.peterssoftware.com/cr.htm

I don't even know if it does what you need it to, but if it works out let me know - I might incorporate it into some of my reports!

Regards,
John
 
Try changing the controlsource of the header group(which reflects the field/expression option in the grouping and sorting dialog) and changing the control sources of the relevant fields in your report. Remember also that you may need to change the other properties of your header to reflect the new group inclusion criteria(groupby, groupon etc.)
 
Thanks John. Have downloaded as suggested. Will check it out and get back to you.

Dave:)
 
Fornatian

May need a little further explanation of you reply.

Where do I find the control source of the header group? This seems to be what I want to do (Reflect the field/expression option in the grouping and sorting dialog) but I cant locate where to stick the code (No rude suggestions)

Looking forward to working this out
Dave
 
If you enter:

Me.HeaderX.ControlSource = YourFieldName
Me.HeaderFieldName.ControlSource = YourFieldName

(X) being the groupheader name in the OnOpen event that should do it.
 

Users who are viewing this thread

Back
Top Bottom