Enable the use of an ActiveX control in expressions

By default, Microsoft Access does not allow you to use an ActiveX control (ActiveX control: A control, such as a check box or button that offers options to users or runs macros or scripts that automate a task. You can write macros for the control in Microsoft Visual Basic for Applications or scripts in Microsoft Script Editor.) in expressions. It is possible, however, to enable the use of your ActiveX control in expressions when the ActiveX control has been added to a form. Follow these steps to enable the use of an ActiveX control in an expression:

  1. In the Database window, click Modules Button Image under Objects, and then click New on the Database window toolbar.
  2. Type the following code into the module:

Sub EnableActiveXControl()

    SysCmd 14, "<ActiveX Control GUID>"

End Sub

 Note   Replace <ActiveX Control GUID> with the globally unique identifier (GUID) that identifies the ActiveX control that you want to enable in expressions.

  1. Press F5 to run the procedure.

The ActiveX control is added to the list of that Access allows to be used in expressions.

 Notes 

  • You cannot remove an ActiveX control once it has been added to the list of allowed controls.
  • Access allows the use of an ActiveX control in expressions only when the control has been added to a form and the ActiveX control has been loaded by the form. The ActiveX control cannot refer to a property or method of an ActiveX control that has not been added to the form.
 
 
Applies to:
Access 2003