Private Sub btnOK_Click()
Select Case Frame9
Case Is = 0
DoCmd.OpenReport "rptAWM525PhaseTwo1", acViewPreview, ,
"ysnapplicability= " 'missing something here
DoCmd.Maximize
Case Is = 1
DoCmd.OpenReport "rptAWM525PhaseTwo1", acViewPreview, ,
"ysnapplicability=1"
DoCmd.Maximize
Case Is = 2
DoCmd.OpenReport "rptAWM525PhaseTwo1", acViewPreview
DoCmd.Maximize
End Select
End Sub
In your report properties, On Open:
Me.Label8.Caption = Forms!frmForQueryPhaseTwo!strReportTitle
| Thanks Duane,
| This changes the caption in the title bar, but I want to change the
caption
| property for a label control on the report.
| I should have provided more detail perhaps.
| This is the code I've tried:
| Private Sub btnOK_Click()
| Select Case Frame9
| Case Is = 0
| DoCmd.OpenReport "rptAWM525PhaseTwo1", acViewPreview, ,
"ysnapplicability="
| rptAWM525PhaseTwo1.Label8.Caption =
Forms!frmForQueryPhaseTwo.strReportTitle
| DoCmd.Maximize
| Exit Sub
| Case Is = 1
| DoCmd.OpenReport "rptAWM525PhaseTwo1", acViewPreview, ,
"ysnapplicability=1"
| rptAWM525PhaseTwo1.Label8.Caption =
Forms!frmForQueryPhaseTwo.strReportTitle
| DoCmd.Maximize
| Case Is = 2
| DoCmd.OpenReport "rptAWM525PhaseTwo1", acViewPreview
| rptAWM525PhaseTwo1.Label8.Caption =
Forms!frmForQueryPhaseTwo.strReportTitle
| DoCmd.Maximize
| End Select
| End Sub
| This code lets report display appropriate records based on applicability.
| I'm trying to set the report Label8.caption to the forms text box,
| strReportTitle.
| Am I putting the code in the wrong spot or is the code faulty? I get a
| runtime error 424 object required.
| Thanks very much!
|
|
| | > You can use code in the On Open event of the report like:
| >
| > Private Sub Report_Open(Cancel As Integer)
| > On Error Resume Next
| > Me.Caption = Forms!frmSetReportTitle.txtRptTitle
| > End Sub
| >
| >
| > --
| > Duane Hookom
| > MS Access MVP
| >
| >
| > | >>I would like to give a user the ability to set the caption for a report
at
| >>runtime, or in other words give the user the ability to change the title
| >>of the report header.
| >> I have a form that allows the user to enter a report title into a text
| >> box. How can I make this entry the title for the report?
| >> Thanks