Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Check for updates: (c) Microsoft
Office downloads
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
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 (macro: An action or set of actions that you can use to automate tasks.) or an event procedure (event procedure: A procedure that is automatically executed in response to an event initiated by the user or program code, or that is triggered by the system.) 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 (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 the macro (HideDateDue) 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

Callout 1 If the value of the Paid control is Yes ...

Callout 2 ... the macro sets the DateDue control's Visible property to No.

To use an event procedure, add the following Microsoft Visual Basic (Microsoft Visual Basic: A high-level, visual-programming version of Basic. Visual Basic was developed by Microsoft for building Windows-based applications.) code to the Form_Current event procedure:

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

advertisement