Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Edit a report from VBA

Posted on 2012-03-16
4
Medium Priority
?
252 Views
Last Modified: 2012-03-16
Dear Experts

I need to edit a report from a piece of code residing in a form.

Basically I need to replace the reports's tag (which is a string formed from a collation of various data points in the form).This is so the label which acts as the header for the report is changed (it has a control source of =[Report].[Tag])

The report is called "Bespoke Contact Logs by User" and the string to go into [tag] is "StrReportHeader"

Can anybody help?
0
Comment
Question by:correlate
[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
  • 2
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 37729174
Can you use OpenArgs instead?

Docmd.OpenReport "YourReport", WhereCondition:= "Your Criteria", OpenArgs:=StrReportHeader


And in the openevent of the report:

YourLabel.Caption  = Me.OpenArgs
0
 

Author Comment

by:correlate
ID: 37729220
I think so, what I'm planning on doing in VBA is to open the report, edit it, close it & dependant upon user selection this report would then either be emailed, put into Pdf or saved as a pdf ... I cant think of any reason why OpenArgs would work - what do you think?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37729238
It sounds doable.

Another option - assuming the form is open at the time the Report's Open event is exectued, is to refer to the form for the value needed:

Me.MyLabel.Caption = Forms!YourFormName.YourControlThatHoldsTheHeaderText

(you can also place this in the control source of a textbox...)


OpenArgs is a little cleaner, IMO.
0
 

Author Closing Comment

by:correlate
ID: 37729542
Works a treat - thank you very much
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

730 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