• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 689
  • Last Modified:

VB6 - Sort ID AutoNumber descending issue

Hello all

I have a MSHFexgrid1 that have data from my Microsoft Access dbase.

I want to sort column 1 that have the ID AutoNumber from  MS Access.

The problem is that when i do this, i see that result:
99
98... 'going down
89
88...  'going down
29
28...  'going down
100
1

So i don't have a real descending sorting.

How can i fix this?

Thanks again

Full code
'Sort grid
            With MSHFlexGrid1
                .Col = 1
                .Sort = flexSortStringDescending
            End With

Open in new window

0
Wilder1626
Asked:
Wilder1626
3 Solutions
 
Martin LissRetired ProgrammerCommented:
Create a column with zero width. Put the same data in the column except use Format(MyValue,  "00000"). Then sort on that column.
0
 
honestman31Commented:
well, there is nothing wrong with the result you are getting, the result is based on String sorting

and in String sorting  100 is less than 28   ( one is less than 2 )

try to check if there is numeric sorting option or not

.Sort = flexSortNumricDescending  ( not sure if that exist or not , however you got the idea
0
 
IrogSintaCommented:
As mentioned by honestman, you need to use flexSortNumericDescending.  For a list of other sort options, check out this link:
http://msdn.microsoft.com/en-us/library/aa261266(v=vs.60).aspx
0
 
Wilder1626Author Commented:
Hello all

Thanks for all the help.

I will go with this:

            'Sort grid
            With Form3.MSHFlexGrid1
                .Col = 1
                .Sort = flexSortNumericDescending
            End With
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now