I don't understand the need for all the concatenation and quotes. Do either of these do what you want? The second is only needed if there are duplicates:
BuildStr("SELECT [FileNam] FROM Folders ORDER BY [SortKey]"," ")
BuildStr("SELECT [FileNam] FROM Folders GROUP BY [FileNam], Folders.[SortKey] ORDER BY [SortKey]"," ")