fill grid by query while select

Hi,

i have new form and I am looking for to display all record in grid byn specifying my own query ,the fonction may be as well:

static void  queryVendtableSelect(Args _args)
{
    VendTable vendTable;
 

     
    while select firstOnly  *
    from vendTable
    order by   vendTable.AccountNum
     where vendTable.Blocked =="aaaaaaaaa"
                         
    
    }

when can i put this fontion?
any idea. thank you

It doesn’t work like that - what you should do is filtering the data source. See How to: Access the Active Query on Forms [AX 2012].