Reputation: 185
I have a report that can be opened from two different forms, and depending on from which form it is opened, it's title should be changed. For example, if I press the print button on the other form, then it refers to the report it's about to print and uses Label.Caption to change the title.
Does anyone have insight on this?
Upvotes: 0
Views: 32
Reputation: 56026
When you open the form, call it using the parameter OpenArgs (the last parameter):
DoCmd.OpenReport "YourReportName",,,,, Me.Name
Read that when the report is opened:
Private Sub Report_Load()
Me.Caption = Nz(Me.OpenArgs)
End Sub
Upvotes: 2