AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Monday, March 03, 2008

ActiveX control events

When somebody tries to use ActiveX control events for first time – it looks like ActiveX control has only few events:



But this is just a limitation of Access property sheet, it does not show all events. To get all events you can do the following: open form’s class module in VBE, in left top combo select control name, in right top combo – event you need, and event procedure will be inserted into class module:



4 Comments:

Anonymous Anonymous said...

Hi Alex,

I think there is some other general logic.
While we're embedding some ActiveX on form, access creates UserControl object, that contains our ActiceX one.
Very similar to embedding Form Object in Subform Control ...
(Note that SubformControl has different properties and events then Form Object ;-)

So we can see the events defined only for that common "usercontrol" and not for exact object we just embedded in it (ActiveX).

The way you have suggested is right.

But sometimes we need something else.
For example let's embed TreeView control (CommonControl ActiveX).

While we want IntelliSense in VBE we should make something like this:

'form/class module level declaration:
Dim WithEvents tv1 as TreeView
' ^^^^^^^^^^

Private Sub Form_Open(...)
Set tv1 = Me.MyTreeViewCOntrol1.Object
' ^^^^^^
End Sub

and now, in any procedure body in that form module (class module), we can get VBE IntelliSense while calling tv properties and methods (just typing dot after variable) or event procedures (by choosing right one in top-rigth combo, as you're suggesting)

king regards
KN

4:30 AM  
Blogger Alex Dybenko said...

Thanks for update! Here one more link on this technique from FMS:
http://www.fmsinc.com/free/newtips/access/accesstip1.asp

1:05 PM  
Blogger Arthur Arnold said...

To Alex
I looked for several days to find the solution to the invisible events problem. It was clear they were there, but I could not find them or some documentation about the (Treeview V6.0) controls. I was pleased to see your posts.

To Anonymous:
Please explain or provide some links to a better explanation of your solution.

12:55 AM  
Blogger Unknown said...

Thanks for sharing this, looking fowrard to explore more events like this one.
seo agency Melbourne
Custom software development Melbourne
Mobile Apps Development Melbourne

5:37 PM  

Post a Comment

<< Home