I figured it out.
Option box was called get_doc
The string passed with the report title was called stReportName. I had to
make it public for the report to get it. I suppose I could have tried
passing get_doc.
For the button that calls the report I have created code for the On Click.
I entered a Case for each of the 4 options from the get_doc option box which
assigns a title name to the public variable stReportName. On the report I
have a text box where my title will be and in the properties Control Source I
have:
=[Forms]![Frm_Documents].[stReportName].
May not be the best way to do it but it works and I am happy. See code for
report button below. I am adding this to help others who maybe trying to
figure this out.
Thanks for you help because you did help me work through it I just didn't
give you enough information.
Report button code:
Option Explicit
Public stReportName As String
Private Sub Get_Documents_Click()
On Error GoTo Err_Get_Documents_Click
Dim stDocName As String
' For each report select the correct title to display from the user's
selection
Select Case get_doc
Case 5
stReportName = "GPS Subsystem Released Documents"
Case 6
stReportName = "Locally Filed Documents"
Case 7
stReportName = "Locally Stored Media"
Case 8
stReportName = "All Documents and Media"
End Select
'If the user wants to see all of the records then change get_doc to an "*" so
' that all records are retrieved and displayed in the report. Otherwise, just
' retrieve the records that match the request.
If get_doc = "8" Then get_doc = "*"
stDocName = "Rpt_Documents"
DoCmd.OpenReport stDocName, acPreview
Exit_Get_Documents_Click:
Exit Sub
Err_Get_Documents_Click:
MsgBox Err.Description
Resume Exit_Get_Documents_Click
End Sub
________________________________________________________________________________________________________________________________________
June said:
I have a form using an Option Group box that calls the same report and
displays the records that the user has chosen. I have 4 choices for them to
choose from and then the report is displayed filtered with the records that
they chose. What I want to do is have the report title display what kind of
report they chose. How do I create a variable that will show up on the
report?