Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in design view and replacing code

Status
Not open for further replies.

sqlmonkey

Programmer
Aug 28, 2003
3
US
i want to replace part of the code i have in each text box, but i can't do a replace or a find in the design view of the reports? i have to manually go into each text box, go to the properties, then edit the control source to change part of the code. I wouldn't mind it, but i have to edit 129 reports and there is 40 fields in each report i have to change, i calculated it and it would take me 9 hours to change all the code. i was wondering if there was a way to do a find then replace part of the code i need to change in each report or to edit the code through like another program.
 
Without 3rd party tools, this is not easy.

What you can do is write code to make the changes. Set up a procedure where you can pass in the name of the report. In code, open the report in design view. Loop thru all the controls, check for the text you're tyring to change in the controlsource (using if) and change the value if you find what you're looking for.

First, make a copy of one of the reports and test on the copy, so you don't mess up the original if you're code doesn't work.

You can loop thru all the controls using something like:
Dim ctl as Control
For each ctl in Me.Controls
If TypeOf ctl is Textbox Then
If ctl.ControlSource = "ABC" Then
<apply change>
End If
End If
Next ctl

If you're looking for a substring of the ControlSource and not the entire value, the &quot;ABC&quot; line will look different, but that's the easy part.

Once you got the routine straight, put the call to it in a loop where you cycle thru all the reports.
 
you mentioned 3rd party programs, which 3rd party programs do you recomend, because i'm not too good yet with VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top