Help with report header from VBA

Linus_99

Board Regular
Joined
Aug 28, 2002
Messages
145
Hi,

I'm generating a report (Report1) from a VBA module with:

DoCmd.OpenReport reportname:="Report1", view:=acViewPreview, wherecondition:=strWhere

I have a caption string (strDesc) that I would like to put on the report and on the preview.

I can put the string on the title bar of the preview with:

Reports![Report1].Caption = strDesc

Can anyone please advise how I can put this string in the page header of the report, or in the report header of the report ?

Any advice would be appreciated.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi Linus_99,

Declare strDesc variable in Form declaration section and as Public:

Code:
Public strDesc As String

Create a textbox on the report page header and change its ControlSource property as following (Assuming your form name is Form1)

=[Forms]('Form1').[strDesc]

I hope it helps.
Suat
 
Upvote 0

Forum statistics

Threads
1,221,773
Messages
6,161,855
Members
451,724
Latest member
sledparty

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top