The trick to doing this would be to do them in the order you desire.
To loop through the controls, open the form in design view, loop through the
controls, see what type of control each is, and concatenate the number onto
the current caption.
Untested, very general, example:
Dim ctl As Control, strForm As String, intButton As Integer, intTextbox As
Integer
'create a loop here to go through all of the forms
strForm = "frmFormNam e"
DoCmd.OpenForm strForm,acDesig n,,,,acHidden 'hidden is optional
For Each ctl In Forms(strForm). Controls
If ctl.ControlType = acCommandButton Then
intButton = intButton + 1
ctl.Caption = ctl.Caption & intButton
End If
If ctl.ControlType = acLabel Then
'get the associated control, is it a textbox?
If ctl.Parent.Cont rolType = acTextbox Then
intTextbox = intTextbox + 1
ctl.Caption = ctl.Caption & intTextbox
End If
End If
Next
DoCmd.Close acForm, strForm, acSaveYes
--
Wayne Morgan
MS Access MVP
"MLH" <CR**@NorthStat e.net> wrote in message
news:l7******** *************** *********@4ax.c om...
This is one for you gurus. Someone has undoubtedly already done this.
How difficult would it be to recurse all command buttons and textbox
controls on all forms, appending an incrementing number to the end of
their Caption property strings? Say I have 10 forms with 10 such
controls each, I would like to have " (001)" - " (100)" appended to
the end of each of their Caption property strings.
Of course, I know about the manual brute force technique. I would
like to automate the job with a procedure in a class module.