Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / October 2004

Tip: Looking for answers? Try searching our database.

Display a report title by what criteria was chosen

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
June - 27 Oct 2004 22:03 GMT
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?

Thanks in advance and please explain the steps for me as I am learning Access

June
Marshall Barton - 28 Oct 2004 00:54 GMT
>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?

Use a text box in the report header section.  Set the text
box's Control Source property to refer to the form's Option
Group to get the option number.  You haven't explained how
you wabt to translate the number to something more
meaningful to your users, so, at this point I can only say
how to get the number:

    =Forms![the form name].[the option group name]

Signature

Marsh
MVP [MS Access]

June - 28 Oct 2004 13:59 GMT
I want to display a title that corresponds with the option that they chose.  
The would be, "Filed Documents, Released Documents, Filed Media, All
Documents & Media"

I want to capture the option that they chose and have it select the title
for the report.

Thanks,

June

> >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
[quoted text clipped - 11 lines]
>
>     =Forms![the form name].[the option group name]
June - 28 Oct 2004 14:55 GMT
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.

Thanks and keep up the good work,

June

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 Su
________________________________________________________________________________________________________________________________________

> 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
[quoted text clipped - 6 lines]
>
> June
Marshall Barton - 28 Oct 2004 23:37 GMT
Yes you did!

Actually, the code you're using is an excellent way to do
this and what I would have recommended.

Keep up the good work.
Signature

Marsh
MVP [MS Access]

>I figured it out.  
>
[quoted text clipped - 63 lines]
>> report they chose.  How do I create a variable that will show up on the
>> report?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.