Real Software Forums
http://forums.realsoftware.com/

PopupMenu Ascending Order?
http://forums.realsoftware.com/viewtopic.php?f=10&t=47908
Page 1 of 1

Author:  RicSum [ Fri May 17, 2013 12:11 pm ]
Post subject:  PopupMenu Ascending Order?

Hi,
My popupmenu is populated from a database and the code below works perfectly, HOWEVER,
would it be possible to modify the code in order to cause the entries in the popupmenu to be displayed in Ascending order ?


Dim stSQL as String

If db8.Connect = True Then
stSql = "SELECT Sonames FROM SettingsTable"
rs8 = dB8.SQLSelect(stSql)

if rs8 = nil then
msgbox "Problem with Database!"

else
while not rs8.EOF
win_Add.PopupMenu2.AddRow rs8.Field("Sonames").StringValue
rs8.MoveNext
wend
end
end if
rs8.Close


Thank you all in advance.

Author:  timhare [ Fri May 17, 2013 12:31 pm ]
Post subject:  Re: PopupMenu Ascending Order?

Add an ORDER BY clause to your sql statement to retrieve them in the order you want.

select sonames from SettingsTable order by sonames

Author:  RicSum [ Fri May 17, 2013 12:53 pm ]
Post subject:  Re: PopupMenu Ascending Order?

Duhhhh,
Thanks Tim :)

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/