Example of setting the value of a property in response to an event

Example of setting the value of a property in response to an event

You can set the value of a property based on a value in the current record by running a macro or an event procedure in response to the form's Current event. For example, you might want the DateDue control on an Orders form to be hidden if the order is already paid for (if the value of the Paid control is Yes or True).

To run a macro, set the form's OnCurrent event property to the name of a macro that sets the DateDue control's Visible property to No if the value of the Paid control is Yes.

Set a value based on an event

To use an event procedure, add the following Visual Basic code to the Form_Current event procedure:

If Me![Paid] = True Then
    Me![DateDue].Visible = False
Else
    Me![DateDue].Visible = True
End If