Sort problem..... 
Author Message
 Sort problem.....

Hi,

I'm trying to sort a dbgrid, but because I made the field names long (i.e.,
Home Phone Number, Work Phone Number), I keep getting a syntax error when I
click on the column header to do the sort....

My code is as follows:

Select * From List Order By " & Form2.DBGrid1.Columns(ColIndex).DataField

Can I not do this because of the longer field names, or am I missing
something?  I've already shortened a few of them, and the sort works fine,
but I really don't want to shorten any more of the field names...

Thanks,

Serafino



Tue, 25 Dec 2001 03:00:00 GMT
 Sort problem.....

Thanks a lot!  I knew it was going to end up being something simple that I
had overlooked!

Thanks a bunch!

Serafino



Tue, 25 Dec 2001 03:00:00 GMT
 Sort problem.....
Try:

"Select * From List Order By [" & Form2.DBGrid1.Columns(ColIndex).DataField
& "]"


Quote:
> Hi,

> I'm trying to sort a dbgrid, but because I made the field names long
(i.e.,
> Home Phone Number, Work Phone Number), I keep getting a syntax error when
I
> click on the column header to do the sort....

> My code is as follows:

> Select * From List Order By " & Form2.DBGrid1.Columns(ColIndex).DataField

> Can I not do this because of the longer field names, or am I missing
> something?  I've already shortened a few of them, and the sort works fine,
> but I really don't want to shorten any more of the field names...

> Thanks,

> Serafino



Wed, 26 Dec 2001 03:00:00 GMT
 Sort problem.....
You have to use square brakets for the field name and table name if there
are spaces inside them.

"Select * From [List Order] By [" &
Form2.DBGrid1.Columns(ColIndex).DataField & "]"
Bye

--


www.damanhur.it


Quote:
> Hi,

> I'm trying to sort a dbgrid, but because I made the field names long
(i.e.,
> Home Phone Number, Work Phone Number), I keep getting a syntax error when
I
> click on the column header to do the sort....

> My code is as follows:

> Select * From List Order By " & Form2.DBGrid1.Columns(ColIndex).DataField

> Can I not do this because of the longer field names, or am I missing
> something?  I've already shortened a few of them, and the sort works fine,
> but I really don't want to shorten any more of the field names...

> Thanks,

> Serafino



Thu, 27 Dec 2001 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Sorting problem RS.SORT !!!

2. Sorting problem

3. Sort problem

4. Sort Problem

5. SQL 7.0 sort problem

6. Refresh Cube and Sorting Problem

7. SQL 7.0 sort problem

8. Sort problem

9. SQL 7.0 sort problem

10. Sorting Problem while Joining two Tables in SQL 2000

11. sort problem

12. Sorting problem ?


 
Powered by phpBB® Forum Software