Form refresh Query run issue

Hi Team,

I have requirement to develop the total count of inventory available based on location while selecting the location based on Filter using (Ctrl+G). As per requirement i have written a logic for that.

Above logic is working fine.

Now the issue with Onhand form, we have a dimension display form to select the location. After selection the location and accepting the changes i am getting an error from in the above screenshot highlighted line . I am attaching the screen shot of the error below.

I hope the form is trying to refresh the form that time query run is missing.

Any help to fix this error.

Thanks in advance.