combobox, sorting DESC

  • Thread starter Thread starter Wim
  • Start date Start date
W

Wim

Hi,

I have a combobox; its rowsource is determined by another
one (StudentCbo). Everything works fine, but I'd liked to
have it sorted descending, which I don't seem to manage.

The VBcode in the AfterUpdate event of the "determining"
combobox :

Me.CourseCbo.RowSource = "select [StudentId], [CourseId],
[InscriptionId] from [Courses] where [StudentId] = " &
lngKey

where lngKey is the value of the StudentCbo.

Now I can see the courses in the order of the
inscriptions, so oldest ones first. But I want to see the
latest courses first.

I had an snippet of code like :

Me.CourseCbo.RowSource = "select [StudentId], [CourseId],
[InscriptionId] from [Courses] where [StudentId] = " &
lngKey & " sort by CourseId DESC"

but that doesn't work. Anyone a hint ?

Thanks,

Wim
 
Wim said:
I have a combobox; its rowsource is determined by another
one (StudentCbo). Everything works fine, but I'd liked to
have it sorted descending, which I don't seem to manage. []
I had an snippet of code like :

Me.CourseCbo.RowSource = "select [StudentId], [CourseId],
[InscriptionId] from [Courses] where [StudentId] = " &
lngKey & " sort by CourseId DESC"

but that doesn't work. Anyone a hint ?


Hint: it's Order By
 
Marsh,

Thanks for the hint, I'll give it a try, though I think I
originally wrote it like that.

W
-----Original Message-----
Wim said:
I have a combobox; its rowsource is determined by another
one (StudentCbo). Everything works fine, but I'd liked to
have it sorted descending, which I don't seem to manage. []
I had an snippet of code like :

Me.CourseCbo.RowSource = "select [StudentId], [CourseId],
[InscriptionId] from [Courses] where [StudentId] = " &
lngKey & " sort by CourseId DESC"

but that doesn't work. Anyone a hint ?


Hint: it's Order By
 
Marsh,

You were right. Problem solved. Thank you !

Wim
-----Original Message-----
Wim said:
I have a combobox; its rowsource is determined by another
one (StudentCbo). Everything works fine, but I'd liked to
have it sorted descending, which I don't seem to manage. []
I had an snippet of code like :

Me.CourseCbo.RowSource = "select [StudentId], [CourseId],
[InscriptionId] from [Courses] where [StudentId] = " &
lngKey & " sort by CourseId DESC"

but that doesn't work. Anyone a hint ?


Hint: it's Order By
 
Back
Top