Working with OLE Controls in Microsoft Access

A Microsoft Access 2.0 developer uses the methods associated with a custom control to manipulate that control. For example, you could use the NextMonth and PreviousMonth methods for the Calendar control to display the calendar for the subsequent or prior month. A developer uses the events associated with a control to update the control or to synchronize the control with a selected record, section, or environment. For example, you could use the Click event for the Calendar control to start a procedure that retrieves the specified date and adds it to the appropriate record. A developer uses the properties associated with a control to display or retrieve data. For example, you could use the Value property for the Calendar control to retrieve the date selected by the user.

The events for an OLE custom control can be accessed through the drop-down list box in the module toolbar. In some cases, the events for an OLE custom control have identical names to the events for the unbound object frame. When this happens, Microsoft Access 2.0 always gives precedence to the custom control's event procedure.

The properties for an OLE custom control can be set using Microsoft Access Basic or the property sheet associated with the control. You can access this property sheet via the right-click menu, select the Control Object option, and click Properties.

To add an OLE custom control to a form:

  1. Click the unbound frame tool in the toolbox.
  2. Drag to create a frame of the size that you want.
  3. Microsoft Access displays the Insert Object dialog box; click the Insert Control button.
  4. If the required control doesn't appear in the Control Type list, click the Add New Type button and add the control.

  5. Otherwise, choose the desired control from the Control Type list in the Insert Object dialog box.