Renmaing all controls on a form

S

SmilingPolitely

How do I go about permanently renaming all controls on a form?

I am studying at Uni and the lecturer wants us to use 'Hungarian
notation' for all controls, i.e. labels are named lblWhatever and
textboxes txtWhatever etc.

Happy with the results of using the forms wizards to save time, it takes
ages to go through every form and see if the controls are correctly
labelled and if not, change the control name.

I was hoping to programmatically do this by doing something along the
lines of:

For each form in database
open form for editing
for each control in form being edited
select type of control
control is label
if label hasn't already been renamed then
rename label
control is textbox
if textbox hasn't already been renamed then
rename textbox
etc. etc. etc.
then save the edited form


But, how do I change all the underlying code on that form and in any
modules, queries etc? Will my Button_onClick() event procedure
automatically be able to find the, now renamed, cmdButton_onClick()
procedure? How will my existing code find the newly renamed controls
for SQL criteria? etc?

Any assistance would be appreciated.


P.S. I am trying to change about 35 forms in a database, each form is
quite large with many controls - hence the reason for trying to find a
faster way to achieve the aim.
 
D

Douglas J. Steele

Top