You probably don’t need FormA and FormB, but you can use the same form.
In the init method of the FormA/B, you would use element.args().record() to get the parent record, and element.args().caller() to get the parent form object.
Use just one form, check the caller of the form and in init like Alex said in the last post, and them overwrite the executeQuery method in your DataSource so you create another filter based in the QueryBuildRange object.