Solved

Edit a report from VBA

Posted on 2012-03-16
4
248 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

622 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