Why can't I sort? Query

I have an SQL statement that selects on a predefined criteria and I want to sort the results in the query before I return them. But I get an error

`rsDataSet = dbFinances.SelectSQL( "SELECT * FROM tblPurchaseSources ORDER BY nomenclature WHERE productType=?", strName )`

← This throws the following error: Database Exception : near “WHERE”: syntax error

rsDataSet = dbFinances.SelectSQL( "SELECT * FROM tblPurchaseSources WHERE productType=?", strName )

but this works…

The ORDER BY Keyword must go AFTER the WHERE


Oy! Thank you! Well looky thar! It works now!

Mark Ivan’s post as the solution please.

1 Like