change text in several reports quickly

  • Thread starter Partha Mandayam
  • Start date
P

Partha Mandayam

I have 100 reports in which I need to change a title string from one value
to another. Is there a quick way to do this rather than manually changing
each one?
 
E

Eric Butts

Hi,

Here's an example if you are attempting to change the ControlSource of
textbox control to something else: (note that the textbox control in each
report is named "text7")


Dim rpt As Object
Dim rptDesign As Report

For Each rpt In CurrentProject.AllReports

DoCmd.OpenReport rpt.Name, acViewDesign

Set rptDesign = Reports(rpt.Name)

rptDesign.text7.ControlSource = "test"

DoCmd.Close acReport, rpt.Name, acSaveYes

Next rpt


I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
 
E

Eric Butts

Hi Partha,

(could you respond to the post instead...that way other readers can see
your reply... thanks)

Partha Mandayam said:
i just want to search a particular string in all reports and replace
with another. as per your code i must have the same text box control
news:[email protected]...

When you say search a string I guess you are stating you would like to
search a string that resides in some type of control in your Report (can't
have a string that's not in a control e.g., textbox or label)

If for instance your string is "the cow jumped over the moon" and it
resides in every Report but in each Report it resides in different textbox
control (as an example) then you can use the below solution to Loop thru
the controls in a Report/Form, and combine it with the solution below to
replace a string with another string.

210252 ACC2000: How to Use Code to Cycle Through the Controls on a Form
http://support.microsoft.com/?id=210252
(same for Reports)

210465 ACC2000: How to Replace a String with Another String
http://support.microsoft.com/?id=210465

Without writing the code it would entail the following:

For Each rpt In CurrentProject.AllReports
' open Report in design (see previous post)

' use code in 210252 to loop thru
Controls
' use code in 210465 to
replace string
' end of code in 210252

' close Report (see previous post)

Next rpt

If you are not into writing the VBA code Speed Freet (not sure of the
spelling) has software that does such things..... search google.com.


Thanks..
 
T

Terry

Partha,

No quick way that I know of.

If this is likely to be a regular requirement try putting
the title string into a subreport and placing the one
subreport into your 100 other reports in place of the
current title string. Next time the string needs to change
you only have to change the one subreport.

Sorry, not really the answer you were hoping for.


Terry
 
E

Eric Butts

My sample just used the same textbox control for simplicity sake.

Use the code in
210252 ACC2000: How to Use Code to Cycle Through the Controls on a Form
http://support.microsoft.com/?id=210252
(same for Reports)


See Microsoft Access help topic "Reports Collection" for details
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top