Mat,
Just to add a little to the other replies, you are better off just building the phrases as strings and issuing:
lcSQL = "from table..."
SELECT &lcSQL
instead of
lcSQL = "select ..."
&lcSQL
If it should happen that you don't have any other SELECT statements in your code an .exe can fail with a "Feature Not Available" error because VFP wouldn't include the necessary support for the SELECT command since it didn't find any SELECT statements during the compile.