The best way to do this (for me who do not know if there is an existing pattern) is to create a Helper for the zTable object.
A helper is a Delphi class helper that you can use to add more functionality to a class without necessarily altering its structure or making a class derived from it. That is, you will be able to continue using the component directly from the Delphi component palette.
TTableHelper = class helper for TzTable
public
  function OpenFromForm: boolean;
  function CloseFromForm: boolean;
  IsFormOpened: boolean;
  IsFormClosed: boolean;
end;
function TTableHelper.CloseFromForm: boolean;
begin
  try
    Self.Active := False;
    Result := True;
    ISFormClosed := True;
  except
    Result := False;
  end;
end;
function TTableHelper.OpenFromForm: boolean;
begin
  try
    Self.Active := True;
    Result := True;
    ISFormOpened := True;
  except
    Result := False;
  end;
end;
Do the following:
- Create a new Unit;
- Put this Unit in the clause usesof eachFormand ofData Modulewhat to use;
- When opening the table from the form, use  table.OpenFromForm;
- When closing the table by form, use table.CloseFromForm;
In the Data Module use: 
if table.IsFormOpened then
begin
  table.isFormOpened := False;
  table.Close;
end;
							
							
						 
For me it is not very clear what you are saying. Could put more information. I don’t know if this solves your problem, but it is good practice to close the query when you are no longer using.
– Daniel Grillo
From what I understand, you have an object shared among several Rfms and want to know who originally opened this object to close it. That’s right?
– utluiz
That’s right... :)
– Thiago Thaison