Sorting list in DBCombo 
Author Message
 Sorting list in DBCombo

This may seem like a really stupid question for all you master programmers
out there, but how do you sort out a list in aphabetical order in a DBCombo
?

Thanks in Advance,

Vince



Sat, 12 Jan 2002 03:00:00 GMT  
 Sorting list in DBCombo
Hi there,

If you are using the data control to populate your dbcombo:-

  The way to make your DBcombo sorted is to use an SQL string in your Data
control's  .Recordsource property eg. "select * from titles order by title
asc;" instead of just a table name from the dropdown list.

this will sort the recordset being used ascending..

Best Regards,
G. Wonfor


or


Quote:
> This may seem like a really stupid question for all you master programmers
> out there, but how do you sort out a list in aphabetical order in a
DBCombo
> ?

> Thanks in Advance,

> Vince



Sat, 12 Jan 2002 03:00:00 GMT  
 Sorting list in DBCombo
hi

Thank you your help partly solved my problem. The list composed only of
numbers works fine. However, the one containing text doesn`t work for some
reason. Here is the code for it :

With form1
            .Data1.Connect = "Dbase III"
            .Data1.DataBaseName = path
            .Data1.RecordSource = "SELECT C_Number FROM Clients ORDER BY
C_Number"
            .Data2.Connect = "Dbase III"
            .Data2.DataBaseName = path
            .Data2.RecordSource = "SELECT Domain_Number FROM Domain ORDER BY
Domain_ Number"
            .Data3.Connect = "Dbase III"
            .Data3.DataBaseName = path
            .Data3.RecordSource = "SELECT C_Name FROM Clients ORDER BY
C_Name "
            .DBNoClient.ListField = "C_Number"
            .DBNomClient.ListField =
"C_Name" ------------------------------->  program bugs here
            .DBDomaine.ListField = "Domain_Number"
End With

If I skip the line the rest of the program works fine (except for that
dbCombo).

Any ideas ?

Vince


Quote:
>Hi there,

>If you are using the data control to populate your dbcombo:-

>  The way to make your DBcombo sorted is to use an SQL string in your Data
>control's  .Recordsource property eg. "select * from titles order by title
>asc;" instead of just a table name from the dropdown list.

>this will sort the recordset being used ascending..

>Best Regards,
>G. Wonfor


>or



>> This may seem like a really stupid question for all you master
programmers
>> out there, but how do you sort out a list in aphabetical order in a
>DBCombo
>> ?

>> Thanks in Advance,

>> Vince



Sat, 12 Jan 2002 03:00:00 GMT  
 Sorting list in DBCombo
Hello once again,

Please disregard my last message. SQL didn`t work at all, I just looked a
little fast. I guess it can't be used with dBase 3 files...

Still looking for help

Vince



Sat, 12 Jan 2002 03:00:00 GMT  
 Sorting list in DBCombo
oh..

I think it should work.............
i don't use dbase but it works for SQLServer7..
I noticed that the SQL that you entered didn't have asc/desc on the end...

Data2.RecordSource = "SELECT Domain_Number FROM Domain ORDER BY Domain_
Number"

If that doesn't make the difference,  you could  create a recordset in code
then append it to the datacontrol..
eg.

set rst=db.openrecordset("SELECT Domain_Number FROM Domain ORDER BY Domain_
Number asc;")
set data2.recordset=rst

You will obviously need to create a workspace and database object first..

Are you using DAO/ODBC??....
Are you running vb6??.....if so ADO is well worth a look as it is much
better at dealing with 'other' databases than DAO..

Best Regards,
Mr. G. Wonfor


Quote:
> Hello once again,

> Please disregard my last message. SQL didn`t work at all, I just looked a
> little fast. I guess it can't be used with dBase 3 files...

> Still looking for help

> Vince



Sun, 13 Jan 2002 03:00:00 GMT  
 Sorting list in DBCombo
Hi again,

Well, it still doesn't work. All the SQL I got through made no difference at
all. Even with asc; / desc; at the end.

If I do it it the recordset way, what do I do to fill my list up again ?
data.listfield didn't work.

What is this ADO you're talking about ? it would probably help me out quite
a bit. As you can tell, I am still a huge beginner in VB and getting more
and more frustrated by the minute.

I am using VB 5 if it makes a difference.

Hoping to finish this soon,

Vince



Sun, 13 Jan 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Sorting list field in dbcombo?

2. Sorting DBCombo List

3. How to sort a list on a DBCombo?

4. Sorting a dbcombo

5. How to sort a DBCombo Box?

6. Sorting a dbCombo box

7. Sorting a DBCombo.

8. Sorting DBCombo?

9. VB6/Ac97/DBcombo/sort

10. Sort a DBCombo please

11. DBCombo: Sort more boxes

12. Sorting items in DBCombo box

 

 
Powered by phpBB® Forum Software