Set the value of a control based on the value of another control by using Visual Basic

Set the value of a control based on the value of another control by using Visual Basic

  1. Create a Visual Basic procedure.

    How?

  2. Add an assignment statement to the procedure by typing the identifier for the control whose value you want to set, an equal sign (=), and the identifier for the control whose value you want to assign to the first control.

    To refer to the value of a control on the current form, type the Me keyword followed by the ! operator and the name of the control. For example, the following statement assigns the value of the City control on the current form to the ShipCity control on the current form:

    Me![ShipCity] = Me![City]

    To refer to the value of a control on a different form, type the control's full identifier. For example, the following identifier refers to the ShipCity control on the ShipForm form:

    Forms![ShipForm]![ShipCity]

  3. Run the procedure.

    How?

For more information about referring to the value of a control, click .