Results 1 to 5 of 5

Thread: ADO Sorts (VB6)

  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ADO Sorts (VB6)

    I have an ADO recordset that I built and am using it to populate a combo box (using a looping method with the AddNew). I wanted to sort the records in the combo box and tried to use the sort property in my method that builds the recordset. at the end of the procedure I am using:

    rs.Sort = "name Asc"

    It doesn't error but it does nothing, and (of course) the help file gives no examples on its use.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ADO Sorts (VB6)

    <img src=/S/confused.gif border=0 alt=confused width=15 height=20> Are you trying to sort the recordset and then step through it to populate the combobox? If this is a VB combobox, why not just set its Sorted property to Yes? Or is the value numeric?
    Charlotte

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADO Sorts (VB6)

    I don't know if this suggestion will apply here, but it is absolutely necessary with ASP and sometimes even with Access...

    One pitfall that's caught me a few times is the CursorLocation. I believe the default is adUseServer which sometimes does not expose the Sort property.
    Try setting the Recordset's CursorLocation to adUseClient - of course, only if you're still having trouble after you've tried Charlotte's suggestion <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    P.S. It's typically bad practice to use the word "name" alone as a field name - just because it can be easily mistaken in some environments for the Name property....Try Client_Name or First_Name, or whatever is relevant in your case... <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADO Sorts (VB6)

    Thanks Carpe. Charlotte's suggestion did work (in fact, I feel a little dumb that I didn't notice that property of the combo box).

    Anyhow, I agree with you on the naming convention. In this particular case I am using LDAP to get data out of AD and the SQL it uses is not familiar to me. "name" is the way it returns and haven't experimented with using alias with that yet.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADO Sorts (VB6)

    Thank you, Charlotte. It is a VB combobox, it is text, and setting its sorted property to True worked perfectly.

Posting Permissions

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