FoxProProgrammer
Programmer
Hi,
Is there a way to change the name of a Control in a VBA program? I have the following:
newName is calculated properly, but an error occurs when itm.Name is assigned to newName. The error is:
To set this property, open the form or report in Design view.
Thank you,
dz
Is there a way to change the name of a Control in a VBA program? I have the following:
Code:
Dim itm As Control
Dim oldName, newName as String
For Each itm In Form.Controls
If itm.ControlType = acOptionButton Then
oldName = itm.Name
newName = Left(oldName, 2) & "p" & Right(oldName, Len(oldName) - 3)
itm.Name = newName
End If
Next
newName is calculated properly, but an error occurs when itm.Name is assigned to newName. The error is:
To set this property, open the form or report in Design view.
Thank you,
dz