Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB6 - Sort ID AutoNumber descending issue

Posted on 2012-12-29
4
Medium Priority
?
683 Views
Last Modified: 2012-12-29
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
Comment
Question by:Wilder1626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 668 total points
ID: 38730124
Create a column with zero width. Put the same data in the column except use Format(MyValue,  "00000"). Then sort on that column.
0
 
LVL 10

Accepted Solution

by:
honestman31 earned 668 total points
ID: 38730128
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
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 664 total points
ID: 38730134
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
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 38730139
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question