Actually, I take that back. The error is happening in the sort criteria, not the search criteria. Line 92: #PreserveSingleQuotes(WADA_Sort_1.FinalOrderClause)# . I've also coded this in to include which table it's from, dbo.tblApplicationScores.applicationID, but that's not making any difference.