the control. The bound controls, for example, create a name using the name of the bound field;
labels create a name using caption text, and so forth:
Public Function ControlCS(ctl As Access.Control, _
strPrefix As String, blnTag As Boolean) As Integer
Does group renaming of all controls with control sources on a form or report.
On Error GoTo ErrorHandler
Dim strControlSource As String
strControlSource = Nz(ctl.ControlSource)
pstrOldCtlName = ctl.ControlName
Check whether control already is correctly named and also special case for controls whose original
name starts with “Option” or “Frame” (same first three letters as prefix).
If Left(pstrOldCtlName, 3) = strPrefix And _
Left(pstrOldCtlName, 6) <> “Option” And _
Left(pstrOldCtlName, 3) = strPrefix And _
Left(pstrOldCtlName, 5) <> “Frame” Then
GoTo ErrorHandlerExit
If the control source is not empty, use it.
ElseIf strControlSource <> “” Then
pstrNewCtlName = strPrefix & _
StripChars(strControlSource)
Else
Otherwise, use the original control name.
pstrNewCtlName = strPrefix & _
StripChars(pstrOldCtlName)
End If
Fix name of “Page x of y” textbox controls on Database Wizard reports.
If pstrNewCtlName = “txtPagePageofPages” Then
pstrNewCtlName = “txtPages”
End If
Show the user
n the original control name
n the control type
n control source
n proposed new name
Part III Adding More Functionality to Office