Does group renaming of all controls with source objects on a form or report.
‘Called from RenameFormControls and RenameReportControls
‘in this module
On Error GoTo ErrorHandler
pstrOldCtlName = ctl.ControlName
pstrSourceObject = Nz(ctl.SourceObject)
If Left(pstrOldCtlName, 3) = strPrefix Then
Exit Function
ElseIf pstrSourceObject <> “” Then
If Left(pstrSourceObject, 3) = “frm” Then
pstrNewCtlName = strPrefix & _
Mid(StripChars(pstrSourceObject), 4)
ElseIf Left(pstrSourceObject, 4) = “fsub” Then
pstrNewCtlName = strPrefix & _
Mid(StripChars(pstrSourceObject), 5)
Else
pstrNewCtlName = strPrefix & _
StripChars(pstrSourceObject)
End If
ElseIf pstrSourceObject = “” Then
If Left(pstrOldCtlName, 3) = “frm” Then
pstrNewCtlName = strPrefix & _
Mid(StripChars(pstrOldCtlName), 4)
ElseIf Left(pstrOldCtlName, 4) = “fsub” Then
pstrNewCtlName = strPrefix & _
Mid(StripChars(pstrOldCtlName), 5)
Else
pstrNewCtlName = strPrefix & _
StripChars(pstrOldCtlName)
End If
Else
pstrNewCtlName = strPrefix & _
StripChars(pstrOldCtlName)
End If
If Right(pstrNewCtlName, 7) = “Subform” Then
pstrNewCtlName = Left(pstrNewCtlName, _
Len(pstrNewCtlName) - 7)
End If
pintRenameFail = True
Do While pintRenameFail
pintRenameFail = False
pintReturn = MsgBox(“Rename “ _
& DLookup(“[ControlTypeName]”, _
“zLNCtblControlType”, “[ControlType] = “ _
Part III Adding More Functionality to Office