Question : Sorting listbox Rowsource

I want to create a multiselect list box of people (resources) ordered by the person's last name and then first name. I can easily do this with the rowsource:

SELECT tbl_Resources.ResourceID, Left([ResourceFName],1) & ". " & [ResourceLName] AS Contact FROM tbl_Resources ORDER BY [ResourceLName], [ResourceFName]

but if I want to include a UNION SELECT to get an "ALL" choice, it looks like I can't ORDER BY [ResourceLName], [ResourceFName] since it's not selected by first query. The best I was able to do is:

SELECT tbl_Resources.ResourceID, Left([ResourceFName],1) & ". " & [ResourceLName] AS Contact FROM tbl_Resources ORDER BY Left([ResourceFName],1) & ". " & [ResourceLName] UNION SELECT '0', '(ALL)' as Bogus FROM tbl_Resources ORDER BY Contact

Is there any way to order by any field in tbl_Resources when using a UNION query or am I forced to use only those fields I select in the initial query? I would like full flexibility in the data I show in the listbox and how it's sorted...

Answer : Sorting listbox Rowsource

sorry for the typo...If you do not need a union query  s/b if you do need a union query

Here is another idea.... instead of using a union query to add "all" to the list, use the function provided at this link, which will enable to add "all" to the list without having to use a union query, enabling to use the Order By as you had previously.
                http://support.microsoft.com/kb/128881
Random Solutions  
 
programming4us programming4us