Define report header from a cmmd button

M

myxmaster

Is it possible to define the report header based on a selected command
button. For example if I have 3 command buttons, Week, Month and Year,
if I select "Month" I would like the report to state Monthly in the
header.
TIA
 
F

fredg

Is it possible to define the report header based on a selected command
button. For example if I have 3 command buttons, Week, Month and Year,
if I select "Month" I would like the report to state Monthly in the
header.
TIA

Sure.
Add an unbound text control to the Form.
Name it txtPeriod
You can make it not visible if you wish.

Code the appropriate command button:
Me.[txtPeriod] = "Monthly" (or "Weekly", etc.)
Docmd.OpenReport "ReportName", acViewPreview

In the Report header, add an unbound text control.
Set it's Control source to:
=forms!FormName!txtPeriod

Note: the form must be open when the report is run.
 
Top