Finding Properties and Methods of an ActiveX Control in Microsoft Access

Provided by the FMS Development Team

Ever wonder why you can't see all of the Properties and Methods of an ActiveX control in Intellisense? Here's a tip of how to get these to show in Intellisense.

When you add an ActiveX control to your application, you're adding new functionality that has a different set of properties in addition to the standard properties of controls in the host (we'll be using MS Access for our example and discussion). While the Microsoft Access properties show up when referencing the object via code, the object's properties do not show until you reference it in a slightly different way.

For instance, to reference a control through standard code, you would make your code look something like the following:

Me.txtMyStandardTextBox.Value = ""

Note that as soon as you type in the period (.) character, a list of properties and methods show in Intellisense. Doing this with an ActiveX control will also show the standard list of properties and methods available through the host environment.

Microsoft Access ActiveX ControlsFor the remainder of our examples we are using the FMS TextEffects control (from the Total Access Components product line) named "fmsTefCtl".

Me.fmsTefCtl.Value = ""

Ok, so is that the Value property we want to use? Not really. While MS Access and the FMS Text Effects control will accept that property being set, the control's object property - also named "Value" - is the one we really want to set. So, what's the difference? MS Access has a standard set of properties available for controls. These properties are shown in intellisense for controls compliant with MS Access. However, an ActiveX control may also have it's own property that happens to have the same name as the MS Access property. The Value property of the FMS Text Effects control is a prime example of this.

To get to the Control Object's properties, you need to reference the code in another way. First you dimension a variable to be the Object type. In other words your code would look like this:

Dim MyTextEffectsCtl As fmstext

Note that in order to see the "fmstext" object in code after the "As" statement, you must have a reference set to the Total Access Components OCX file. To set a reference to this file, simply go to the IDE Toolbar named "Tools, References" and set a reference to the one named "Total Access Components 2000". What? You can't see it? Ok, use the 'Browse' Button on the References Dialog and find the .ocx named "tacomp90.ocx". You'll need to be sure you are viewing 'Files of Type' that are listed as "ActiveX Controls (*.ocx)" in the dropdown on this dialog. (Hint: The tacomp90.ocx is in your Windows System folder if you have the product installed).

Once you have dimensioned the variable as the Object, you can now set that object to the name of the control on the form using the .Object property:

Set MyTextEffectsCtl = fmsTefCtl.Object

Note that the .Object syntax is very important here. You are now able to reference the Object's properties that may be different from the standard MS Access properties you were able to see before. Now you can use the Variable named MyTextEffectsCtl in order to see the FMS Text Effects Control properties specific to the control:

MyTextEffectsCtl.Value = ""

Note that all of the properties and methods specific to this ActiveX control object are now available via Intellisense!

You can do the same thing on SubForms in MS Access by referencing the SubForm Control.Controls property. Note, you should use the Subform Control name, and not the name of the Subform itself. Something like this:

Dim MyTextEffectsCtl_subform As fmstext

Set MyTextEffectsCtl_subform = Me.SubFormControlName.Controls("fmsTefCtlOnTheSubForm").Object

MyTextEffectsCtl_subform.Value = ""

No more guessing if you spelled something properly or if that property or method exists for the control on main forms or subforms.

Happy coding!

Table Design

Query Design

Form Design

Form Tips and Mistakes

Copy Command Button and Keep Picture

Module VBA to Forms and Controls

Form Navigation Caption

Resync Record in a Subform

Synchronize Two Subforms

Multiple OpenArgs Values

Late Bind Tab Subforms

Subform Reference to Control Rather than Field

Tab Page Reference

Shortcut Keys


Combo Box Top 6 Tips

Properties and Validation

Select First Item

Cascading Combo Boxes

Zip, City, State AutoFill

Report Design

Suppress Page Headers and Footers on the First Page of Your Report

Add the NoData Event

Annual Monthly Crosstab Columns

Design Environment

Add Buttons to the Quick Access Toolbar

Collapse the Office Ribbon for more space

VBA Programming

Basics: Forms and Controls

Run VBA Code from a Macro

Use Nz() to Handle Nulls

Avoid Exits in the Body of a Procedure

Shortcut Debugging Keys

Set Module Options

Math Rounding Issues

Rename a File or Folder

Avoid DoEvents in Loops

Age Calculations

Weekday Math

Send Emails with DoCmd.SendObject

Source Code Library

Microsoft Access Modules Library

Microsoft Access Modules

VBA Error Handling

Error Handling and Debugging Techniques

Error Number and Description Reference

Basic Error Handling

Pinpointing the Error Line

Performance Tips

Linked Database

Subdatasheet Name

Visual SourceSafe

Deployment

Runtime Downloads

Simulate Runtime

Prevent Close Box

Disable Design Changes

Broken References

Remote Desktop Connection Setup

Terminal Services and RemoteApp Deployment

Reboot Remote Desktop

Missing Package & Deployment Wizard

Avoid Program Files Folder

Unavailable Mapped Drives

Microsoft Access Front-End Deployment

System Admin

Disaster Recovery Plan

Compact Database

Compact on Close

Database Corruption

Remove 'Save to SharePoint Site' Prompt from an Access Database

Class Not Registered Run-time Error -2147221164

Inconsistent Compile Error

Decompile Database

Bad DLL Calling Convention

Error 3045: Could Not Use

Converting ACCDB to MDB

SQL Server Upsizing

Microsoft Access to SQL Server Upsizing Center

Microsoft Access to SQL Server Upsizing Center

When and How to Upsize Access to SQL Server

SQL Server Express Versions and Downloads

Cloud and Azure

Cloud Implications

MS Access and SQL Azure

Deploying MS Access Linked to SQL Azure

SQL Server Azure Usage and DTU Limits

Visual Studio LightSwitch

LightSwitch Introduction

Comparison Matrix

Additional Resources

Connect with Us

 

Free Product Catalog from FMS