About setting the value of a control or property in response to an event

About setting the value of a control or property in response to an event

By assigning new values to controls and properties in response to events that occur on a form or report, you can make the objects you've created work together so that they're easier to use.

Here are some common situations that call for setting values with a macro or an event procedure:

Setting the value of a control on one form equal to the value of a control on another form

For example, you can put a command button on a Customers form that opens an Orders form and automatically fills in billing information from the Customers form.

Open another form from a command button

Updating the value of a control that's dependent on the value of another control

For example, you might have a PaymentDate control whose default value is the ship date (the value of the ShipDate control). You can use a macro or an event procedure to automatically reset the value of the PaymentDate control whenever the value in the ShipDate control changes.

For more information about setting the value of a control based on the value of another control, click .

Setting a form or control property in response to a selection or other event

You can use a macro or an event procedure to set a form or control property in order to:

For more information about setting the value of a property in response to an event, click .