-----Original Message-----
fredg, the sort order im needing is the one you have
listed in B. That is exactly how im needing them sorted. I
have tried several ways to get them to sort like that but
no go ... I cant seem to get it right. Please if you can
help me with this I would greatly appreciate it.
Thanks again,
C.Ascheman
-----Original Message-----
On Tue, 3 Aug 2004 08:56:57 -0700, Ascheman wrote:
I apologize for leaving out parts. The end result is
supposed to look like this:
662
738
748
9814
9920
0006
0006A
The 0 records (0006 and 0006A) in the database have a 2
placed before them. This was done prior to me coming to
work for the company I now work for. With help I have
managed to remove the leading 2's (Thanks again fredg),
but now my boss wants the report sorted as I show
above.
In other words I need a way (vb code or otherwise) to
make
the system think that 0 is greater than a 9 so it will
sort as he wishes. Please if anyone can help with this
I
will be greatly appreciative and indebted.
C.Ascheman
-----Original Message-----
you say, "how to get it to sort them so it thinks that
a
0 is greater then a
9" but in your example, you simply left off the numbers
starting with "0".
The sort in your two examples is the same.
What are you asking for?
also, a 0 is NOT greater than a 9?!?!?
Thanks to fredg in my below post. Worked perfectly, but
now I am stuck again with no idea how to fix them
problem.
When my reports generate all the records starting with 0
come before any of the other records. Where im stuck is
trying to figure out how to get it to sort them so it
thinks that a 0 is greater then a 9. Here is a sample of
what I am looking at:
0006
0006A
662
738
748
9814
9920
What I need to happen is for the records beggining with
0
to come after the records starting with 9 like this:
662
738
748
9814
9920
Please if anyone knows a way to fix this I would be
greatly indebted to you. If the fix is possible through
vb
its much more preferable.
Thanks in Advance.
C.Ascheman
.
The method will depend upon how you wish to have some
intermediate
values sorted.
a) or b)
662 662
738 738
739 729
740 740
0304 9814
0306 9920
0306A 0006
9814 0006A
9920 0039
0039 0304
0006 0306
0006A 0306A
Notice the difference in sorting after #740.
Let me know which sort order you wish.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
Base your report upon a query.
After you have all your fields included, add a New Column to the
query.
SortThis:IrregularSort([FieldName])
Make sure the Show check box IS checked.
Then copy this function into a new Public Module:
Public Function IrregSort(FieldIn As String) As String
Dim intX As Integer
Dim strNew As String
intX = Asc(FieldIn)
If intX = 48 Then
FieldIn = "z" & FieldIn
End If
IrregSort = FieldIn
End Function
=====
Save and name the module whatever you want, but NOT IrregSort.
Open your Report in Design View.
Click on View + Sorting and Grouping
On the top level Field/Expression box, write
SortThis
Select Ascending as the sorting order.
That should be all you need.
There is no need to sort the query as it's sort order is irrelevant in
the report.
Let me know how you make out.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.