ActiveX Controls and Intellisense

July 13, 2009 by datapig Leave a reply »

Anyone who has had to utilize ActiveX Controls in Access can tell you that Intellisense doesn't automatically kick in for ActiveX Controls. This annoying quirk leaves you blind to the properties and methods of the control.

Here is a quick example of what I mean.

 

In this screen capture, I've added a TreeView ActiveX Control to a new Form in Access.

Right-clicking on the control allows me to get to some properties. One of the properties I can change through the user interface is LineStyle.

 

 

Now if I try to change this property through code, I'll get zero intellisense help from Access. You'll notice in the screenshot below, there is no reference to LineStyle. The properties and methods you see here are those provided by Access for any generic object.

 

In fact, the only way I'd know about LineStyle or any other property of the TreeView ActiveX Control is to see it in either the user interface or some code I stole from the internet.

But here comes the fix.

 

Passing the control through an object variable will show Access which library to hit up for the Intellisense. This will allow you to see all the properties and methods for your ActiveX Control.

You'll notice LineStyle is listed once you pass the control through an object variable.

 

What befuddles me is that Excel doesn't seem to have this issue.

That is, there is no need to pass the ActiveX Control to an object variable in Excel. You can pick up the properties and methods straight on.

 

I can't imagine why Access wouldn't be able to interface with ActiveX Controls with the same convenience as Excel.

Advertisement

Leave a Reply