Clicked method in checkbox to populate the query according to the Employee status


I need to do a process in a customized form designing a checkbox with checked on opening the screen.

If the checkbox is checked then it should populate the query with list of Employee with status Employed

If the user uncheck the check box it should show the terminated employee.

But by default the checkbox to be checked and should show all the Employed status employee list.

I have written the below code in clicked event but i think my code is not correct.

public void clicked()
    CAEEmplTable _caeempltable;
 Query                   query          = new Query();
         Query _query;

    if(this.value()==NoYes::Yes )
    // this.query().dataSourceNo(1).addRange(fieldNum(CAEEmplTable,Status)).value('Employed');


I got the following error

Query object not initialized.