Change text box property via code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking to change the shortcutmenu bar property of all text and memo
boxes on all of my forms. Has anyone ever done this before? Have some code I
could use for an example?
 
Hi, Burt. You can cycle through the members of the Me.Controls collection:

On Error Resume Next
Dim ctl As Control
For Each ctl In Me.Controls
ctl.ShortcutMenuBar = False
Next ctl

The previous code will not crash if the control, such as a label, does not
have the ShortcutMenuBar property, but it will change the value of other
controls, such as combo boxes. If you wish to limit the changes to textboxes
only, use the ControlType property:

On Error Resume Next
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.ShortcutMenuBar = False
End If
Next ctl

Hope that helps.
Sprinks
 
That helps but what I am looking to do is actually open every form, set the
shortcutmenu bar value to "testbar" on textboxes, close and save the form
then go to the next form and do the same until all forms have done it. This
way every text box will use this bar.
 
Back
Top