Solved

Change report name with VBA in ACCESS 2013

Posted on 2014-11-06
8
450 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Simple Linear Regression

724 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