Information About Properties, Methods, and Events of an ActiveX Control

Information About Properties, Methods, and Events of an ActiveX Control

See Also                  Applies To

This topic contains useful information on setting and using ActiveX control language elements in Microsoft Access 2000, and points out some features of ActiveX controls that were added in Microsoft Access 95 and Microsoft Access 97.

Note   This information does not apply for ActiveX controls on a data access page environment.

General

When using ActiveX controls with Microsoft Access 95, you no longer needed to use the Object property when referring to properties and methods in syntax expressions. For example, the following two syntax lines are now normally equivalent:

ActiveXCtl0.Object.MonthLength = 0
ActiveXCtl0.MonthLength = 0

The only exception is if the name of the ActiveX control language element is the same as that of an existing Microsoft Access language element that also applies to this ActiveX control. In this case, you must still use the .Object syntax.

ActiveX control variables can only be dimensioned as type Control; they can't be a more specific type such as Calendar.

Properties

ActiveX control properties appear in the Microsoft Access property sheet. You can set most of these properties in either the ActiveX control's custom properties dialog box or the Microsoft Access property sheet.

Note   The ActiveX control properties aren't listed in the ADO Properties or DAO Properties collections. The only way to access these properties is using the syntax shown in the previous section.

Events

For Microsoft Access events like Enter that apply to ActiveX controls, you can run a macro or event procedure when the event occurs by setting the event property to the name of the macro or [Event Procedure]. However, for events that are specific to ActiveX controls like the NewMonth event of the Calendar control, you must go into the form module in Design view, select the name of the ActiveX control from the Object box, and then select the event from the Procedure box. This creates an event procedure for the ActiveX control event that runs when the event occurs. You can also duplicate the syntax that's created in this case for the event procedure if you want to create it yourself.

If a Microsoft Access event and an ActiveX control event with the same name both apply to a ActiveX control object, Microsoft Access appends "Object" to the ActiveX control event in the Procedure box drop-down list box. This enables you to run a different procedure when each event occurs.