Custom Sorting

  • Thread starter Thread starter jenniferspnc
  • Start date Start date
J

jenniferspnc

I have some customers that I need to show at the top of my report. In my
table those customers have an * at the end of their name (i.e., Customer Z*).
There doesn't have to be any special sort order applied to those customers
with an * at the end of their name. Then any customer without the * on the
end should appear below the other customers in alphabetical order. Is there
a way to do this either in the query or report?

Should look like
Customer Z*
Customer A*
Customer B
Customer F
Customer S
 
Jennifer,
It's not advisable to have fields that conatin 2 pieces of information.
In this case, Some customer data, and some sorting order.
I think it would be better to ad a field to your table called SortFirst
(True/False)
Any customer who needs to sort to the top would have that value set to
True (-1) (remove the splat from your Custmer field)

Now, your report can be sorted (Sorting & Grouping dialog box)...
SortFirst Ascending
CustomerName Ascending
yielding...
Customer A*
Customer Z*
Customer A
Customer F
Customer Z

Or vice versa... which ever you want.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Ma’am,

Add a field in a query that uses the right function to extract customer
names with the * sign and then sort the field.

Here, paste this function in a new query Field:

Right([CustomerName],1)
 
In the sorting and grouping dialog for the report add a sort by
Field/Expression would be
=[Customer] LIKE "*[*]"
Sort Order would be Desc

That sort order should be before the sort order
[Customer] Ascending

As mentioned elsewhere you should probably have an additional field in your
table to flag those customers that get a special sort order.

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top