Your comments

In order for the Generate Outputs button to work, the recordset has to have been defined and the query must be correct. The query above is not valid hence why the button doesn't work.