I think I have a solution.
It's a little bit tricky but here it is:
In my VB.NET application, I can set a data source in my report (by executing a query on the Access database).
The solution consists in creating a subreport and setting another datasource (from another query that selects only the last row) to this subreport.
Then, in my subreport, I created a formula, declaring a shared variable, like that:
WhilePrintingRecords;
shared numbervar niveau_bac_phosphate_fin := {feuilledequart.niveau_bac_phosphate};
The formula has to be added to the report (in any section). However, it is possible to hide the section so that it does not appear. Moreover, it is possible to remove the black borders from the subreport. After that, your subreport is totally invisible.
As for my report, I declare the same variable (without assigning a value):
WhilePrintingRecords;
shared numbervar niveau_bac_phosphate_fin;
And I can use it in the report.
Note that the subreports must be in a section that is above the section where your formulas (the one in which you use the shared variable) are. It cannot even be in the same section.
I know it is tricky as hell but it is this only solution I have found... I've been searching for 3 days :-D
Bye ;-)
Edited by .Spirit - 18 Aug 2011 at 3:28am