ms-accessparametersreporttextfield

How to make a Report title dependent on a parameter?


I have a Form in MS Access 2021 that shows a datasheet dependent on the value of a parameter "year" which is the value of a text field in the same Form. This parameter is used to display the rows in the datasheet that correspond to a given year, by setting the record source of the datasheet being the result of a parameter query. I use for that in the query an SQL statement with the expression [Forms]![FormSalesYear]![Year]. A button in the form allows to have a preview of the report containing the same records as those in the datasheet, i.e. for the given year.

This works correctly but now I would like to have the title in the Report containing that year, e.g. "Sales for 2024".

Is this possible to do? I think I should use the same expression [Forms]![FormSalesYear]![Year] somewhere but it seems that I cannot use that in the "Legend" property of the title text field.

Thanks for your help.


Solution

  • Use this ControlSource for the textbox:

    =[Forms]![FormSalesYear]![Year]