hello
how to set a caption of a label based on the value of a text box in a report ?
regards
Set label caption based on text box value in Report !
-
- BronzeLounger
- Posts: 1211
- Joined: 01 May 2016, 09:58
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Set label caption based on text box value in Report !
Let's say that the label is in the Detail section of the report.
Create an On Format event procedure for this section:
where ThisLabel and ThatTextBox are the names of the label and text box, respectively.
Remark: the code will work when you display the report in Print Preview or print it. It won't work if you display the report in Layout View or in Report View.
Create an On Format event procedure for this section:
Code: Select all
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ThisLabel.Caption = Me.ThatTextBox
End Sub
Remark: the code will work when you display the report in Print Preview or print it. It won't work if you display the report in Layout View or in Report View.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1211
- Joined: 01 May 2016, 09:58
Re: Set label caption based on text box value in Report !
Thanks a lot ... working very well
Regards
Regards