Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / January 2006

Tip: Looking for answers? Try searching our database.

group by field but not sorted ascending or descending

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan M - 23 Nov 2005 21:00 GMT
I want my records grouped by a field but I want to sort them in the order I
want, not ascending or descending. It seems I'm stuck with just the two
choices.
fredg - 23 Nov 2005 21:08 GMT
> I want my records grouped by a field but I want to sort them in the order I
> want, not ascending or descending. It seems I'm stuck with just the two
> choices.

What is the order you want? And how does Access  know what it is?
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Dan M - 23 Nov 2005 21:19 GMT
I'm grouping on a "Status" field with the choices: Active, Archive, Final
Status, Inactive, On Hold, Post Operations.  I want them in the order:
Active, Inactive, Post Operations, Final Status, On Hold, Archive. The
choices are in a drop down box.

> > I want my records grouped by a field but I want to sort them in the order I
> > want, not ascending or descending. It seems I'm stuck with just the two
> > choices.
>
> What is the order you want? And how does Access  know what it is?
Rick Brandt - 23 Nov 2005 22:24 GMT
> I'm grouping on a "Status" field with the choices: Active, Archive,
> Final Status, Inactive, On Hold, Post Operations.  I want them in the
> order: Active, Inactive, Post Operations, Final Status, On Hold,
> Archive. The choices are in a drop down box.

You'll need either an expression or a join to another table that will translate
those into a numeric or alpha character that will give you the sort you want.
The you can sort on that.  The Switch() function for example could give you
this, but a join to a small translation table would be more efficient.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Dan M - 23 Nov 2005 22:49 GMT
Ok, thanks, I'll see what I can do.

> > I'm grouping on a "Status" field with the choices: Active, Archive,
> > Final Status, Inactive, On Hold, Post Operations.  I want them in the
[quoted text clipped - 5 lines]
> The you can sort on that.  The Switch() function for example could give you
> this, but a join to a small translation table would be more efficient.
fredg - 23 Nov 2005 22:34 GMT
> I'm grouping on a "Status" field with the choices: Active, Archive, Final
> Status, Inactive, On Hold, Post Operations.  I want them in the order:
[quoted text clipped - 6 lines]
>>
>> What is the order you want? And how does Access  know what it is?

That's not going to work as you have it now.
Create a table
SortOrder   Number datatype, Integer
Status    Text datatype
TableName   tblSortOrder

Enter each choice in the order you now have them.
Enter the SortOrder for each record in the order you wish it to sort
by in the report, i.e.
1   Active
6   Archive
4   Final Status
2   Inactive
5   On Hold
3   Post Operations   

As rowsource for the Combo box:
Select tblSortOrder.Status, tblSortOrder.SortOrder from tblSortOrder;
Make the bound column column 1.
Set the Column count to 2
Set the column widths to
1";0"
Limit to List to Yes

In the query that is the report's record source add a new column:
SortThis:[Status].Column(1)

In the Report's Sorting and Grouping dialog, place the [SortThis]
field on the top row, sorting ascending.
Then place whatever other fields you wish to group by below it.

The nice thing about this method is that anytime you wish to change
the sorting order, all you need do is re-arrange the SortOrder
numbers.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Dan M - 23 Nov 2005 22:48 GMT
Thank you, I'll give it a try soon.

> > I'm grouping on a "Status" field with the choices: Active, Archive, Final
> > Status, Inactive, On Hold, Post Operations.  I want them in the order:
[quoted text clipped - 41 lines]
> the sorting order, all you need do is re-arrange the SortOrder
> numbers.
Dan M - 23 Nov 2005 23:36 GMT
Hey! Once I figured out what I was doing, it worked great!
Thanx

> > I'm grouping on a "Status" field with the choices: Active, Archive, Final
> > Status, Inactive, On Hold, Post Operations.  I want them in the order:
[quoted text clipped - 41 lines]
> the sorting order, all you need do is re-arrange the SortOrder
> numbers.
DiHo - 05 Jan 2006 17:32 GMT
Fred -
I had the same exact question as Dan, so I was happy so find your response.  
However, I can't make it work.

You said to add a new column to the query.  Does this info get entered in
the "field" row, or where?  Every time I enter it, I get an error.  I've
tried a number of different things, but none work.  For now, please just tell
me where to enter the "SortThis:[Status].Column(1)" statement in the query.
Then, perhaps, it will all fall into place.

Thank you.
Diane

> > I'm grouping on a "Status" field with the choices: Active, Archive, Final
> > Status, Inactive, On Hold, Post Operations.  I want them in the order:
[quoted text clipped - 41 lines]
> the sorting order, all you need do is re-arrange the SortOrder
> numbers.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.