Results 1 to 4 of 4

Thread: Displaying names in Alphabetical Order

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    76

    Displaying names in Alphabetical Order

    Hi,

    I have few names in database. Now i have to display those names in alphabetical order in combo box. I know how to populate the combo box with the records, i just have to display them in alphabetical order.
    Can u guys plz help me what should be written in a query to get the names in alphabetical order.

    Regards,
    Kaushik

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Displaying names in Alphabetical Order

    In your sql query statement add the "ORDER BY Filed1 ASC" where Field1 is the field you want sorted in ascending order to the very end of your statement.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Displaying names in Alphabetical Order

    VB Code:
    1. Combo1.Sorted = True
    CS

  4. #4
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Displaying names in Alphabetical Order

    Select YourFieldList From YourTableName Order By FieldToBeSorted [ASC/DEC]
    By default the sorting order is ascending, if you want decending order then specify that by adding DEC
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width