Having multiple instances of same DataModule, prints data from DM1 in the report of DM2

I have a DataModule for a CRUD of orders and items. This DM is used for the form (VCL) and for print some reports. The TfrxDataSet componentes are in this DM.


When I have the order's form openned showing data from Order 1 and create other instance of same DM do print a report for Order 2, the report show data of Order 1.


Before printing, I'm setting:

Report.EngineOptions.UseGlobalDataSetList := False;

Report.EnabledDataSets.Clear

Report.EnabledDataSets.Add(...datasets from the instance of DM created to print ...)


In the FR3 (XML), there is <item DataSet="dtmNotaVenda.fdsNotaVenda" DataSetName="fdsNotaVenda"/>, where "dtmNotaVenda" is the global var to the DM instance used at Order's form.

Comments

Leave a Comment