Changing label in report with VBA

G

Guest

I want to change the caption in a label on a report depending on which button I press on the switchboard. The following does not work

Reports![Signers]![LabelInHeader].Caption = "BSM Signers"
 
F

fredg

I want to change the caption in a label on a report depending on
which button I press on the switchboard. The following does not
work:

Reports![Signers]![LabelInHeader].Caption = "BSM Signers"


What version of Access?

In Access 2002 or later (I'm not sure about Access 2000):
DoCmd.OpenReport "Signers", acViewPreview, , , , , "BSM Signers"

Then code the Report Header Format event:
Me![LabelInHeader].Caption = Me.OpenArgs

If your version does not have the OpenArgs argument for OpenReport,
you can add an unbound text control to the Form.
Code the Click event of your command button:
Me![ControlName] = "BSM Signers"
DoCmd.OpenReport etc....

Code the Section's Format event:
Me![LabelInHeader].Caption = forms!SwitchboardName!ControlName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top