?
Solved

Change report name with VBA in ACCESS 2013

Posted on 2014-11-06
8
Medium Priority
?
474 Views
Last Modified: 2014-11-11
I have a report that is used by several areas.  I do not want to create five different reports.  I can pass critieris to filter the data, but how to I change the reports title label to read, say, "South", when it is opened?

Sandra
0
Comment
Question by:ssmith94015
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40427399
how are opening the report? post your codes.

you can use Tempvars collection to store the name for yuor report's label

Tempvars.add "myLabel", "<your variable filter here>"

in the open event of your report, or in the print event of the section of the report where you placed the label

place this codes

me.labelName.caption=tempvars!myLabel
0
 

Author Comment

by:ssmith94015
ID: 40427448
I inherited this project and the report is opened with the DoCmd.OpenReports.  Which report depends on which item in a listbox the user selects. So far, I have the below

                       Case 8:  DoCmd.OpenReport "rptAreaReports", acViewReport, , "Zone = ''EU South'' "
                                Reports("rptAreaReports").lblCaption.Properties("caption").Value = "South"

Sandra
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40427481
are you opening just one report, "rptAreaReports" ?

post the whole codes related to the opening the report.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
ssmith94015 earned 0 total points
ID: 40427491
Actually, I got it to work with the OpenArgs argument in the statement so I am good.  Thanks.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 40427509
calling report: pass required title as openArgs of the report.
DoCmd.OpenReport "yourReport", acViewReport, ,,,,"South"

Open event of report:
Private Sub Report_Open(Cancel As Integer)
    Me.titleLabel.Caption = Me.OpenArgs
End Sub
0
 
LVL 85
ID: 40432974
Your solution doesn't really provide any details - could you perhaps post the codes you're using to do this, so other may benefit from it?
0
 

Author Comment

by:ssmith94015
ID: 40433109
Below is the new code.  I just found out from the client that ALL the reports are the same structure, so will be using the pattern for Cases 5,6,7,8,9 for the other report calls

With Me.lstReports
             For I = 0 To .ListCount - 1
                 If .Selected(I) Then
                     Select Case I
                       Case 0:  DoCmd.OpenReport "DealSummary", acViewReport
                       Case 1:  DoCmd.OpenReport "ActivityRpt", acViewReport
                       Case 2:  DoCmd.OpenReport "PartnerRpt", acViewReport
                       Case 3:  DoCmd.OpenReport "ActionDueWeekRpt", acViewReport
                       Case 4:  DoCmd.OpenReport "ActionDueMomthRpt", acViewReport
                       Case 5:  DoCmd.OpenReport "rptAreaReports", acViewPreview, , "ZSM = 'NA East' ", , "Noth America Eastern Zone"
                       Case 6:  DoCmd.OpenReport "rptAreaReports", acViewPreview, , "ZSM = 'NA West' ", , "Noth America Western Zone"
                       Case 7:  DoCmd.OpenReport "rptAreaReports", acViewPreview, , "ZSM = 'EU West' ", , "Western Europe"
                       Case 8:  DoCmd.OpenReport "rptAreaReports", acViewPreview, , "ZSM = 'EU South' ", , "Southern Europe"
                       Case 9:  DoCmd.OpenReport "rptAreaReports", acViewPreview, , "ZSM = 'JPN' ", , "Japan Zone"
                       Case 10: DoCmd.OpenReport "InactiveRpt", acViewReport
                     End Select
                     Exit For
                 End If
             Next
        End With
0
 

Author Closing Comment

by:ssmith94015
ID: 40434614
Solved issue myself.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Simple Linear Regression
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question