Binding a Control to a Field

Binding a Control to a Field

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

If you have created a control using the Control Toolbox and you would like the information in this control to be saved with the form, the control must be bound to a field. This means that a link will be established between the control and the source of data, in this case, a field in the item.

  1. In the Forms Designer, right-click the control you want to bind to a field and then click Properties on the shortcut menu.

  2. On the Value tab, click Choose Field, point to a field set, and then click the field to which you want to bind the control. If you would like to bind the control to a new field that you create, click New. In the New Field box, type the name of your new field in the Name: area. Click OK in the New Field box.

  3. Click OK in the Properties box.

Note Note

If you bind a CheckBox, ComboBox, ListBox, or OptionButton to a field, then the Click event does not fire. You need to use the PropertyChange or CustomPropertyChange event of the item to detect the change via code, as shown in the following example:

Sub Item_PropertyChange(ByVal Name) 
Set MyListBox = Item.GetInspector.ModifiedFormPages("Message").Controls("ListBox1") 
Select Case Name 
 Case "Mileage" 
 Item.CC = MyListBox.Value 
 Item.Subject = MyListBox.Value 
 Case Else 
End Select 
End Sub
© 2016 Microsoft