Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub RenameControlsFromControlSource(argObjectName As String, argObjectType As AcObjectType)
- Dim o As Object
- Dim c As Control
- If argObjectType = acForm Then
- DoCmd.OpenForm argObjectName, acDesign
- Set o = Forms(argObjectName)
- ElseIf argObjectType = acReport Then
- DoCmd.OpenReport argObjectName, acViewDesign
- Set o = Reports(argObjectName)
- Else
- Exit Sub
- End If
- If o.RecordSource & "" <> "" Then
- For Each c In o.Controls
- If c.ControlType = acTextBox Then
- If c.Name <> "txtAppPath" Then
- If c.ControlSource & "" <> "" Then
- c.Name = "txt" & c.ControlSource
- End If
- End If
- ElseIf c.ControlType = acOptionGroup Then
- If c.ControlSource & "" <> "" Then
- c.Name = "rad" & c.ControlSource
- End If
- ElseIf c.ControlType = acCheckBox Then
- If c.ControlSource & "" <> "" Then
- c.Name = "chk" & c.ControlSource
- End If
- End If
- Next
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment