View Full Version : Sorting and grouping for more than 10 fields???


wrek
02-24-2004, 10:39 AM
Access reports currently limit you to sorting a maximum of 10 fields...*

Is there a way in VBA to sort by more? (I have 11)

There is the option that I use a subreport which divide the fields etc...but I'm wondering if theres a workaround to this. Also, sorting the query recordset, doesn't translate onto the report...

Thanks.


(and I know, sorting by more is indicative of poorly structured databases...believe me when I say I have no choice here, my manager is a micro-managing self-professed IT genius...who is a big proponent of 'flat tables' :rolleyes: )

Pat Hartman
02-24-2004, 11:36 AM
Does he also have pointy hair :)
You can create calculated fields in the query and sort on those.

Select fld1, fld2, fld3, fld4, etc, fld1 & fld2 & fld3 as Sort1, fld4 & fld5 & fld6 as Sort2, etc
From YourTable;

Change the report's Sorting and grouping properties to reference the concatenated fields. There is no need to include an order by clause in the query since the report will control sorting if there is any sorting or grouping specified there.

wrek
02-24-2004, 12:19 PM
Now why didn't I think of that?

(11,000 more posts and it'll probably all click)

Thanks Pat, that should work great...

(and 'he' doesnt have pointy hair....SHE does)

Pat Hartman
02-24-2004, 12:40 PM
I use "he" generically. I am quite aware that some pointy-haired bosses are "she's". In fact both my best and worst bosses come from the "she" side of the ledger.