WithEvents in Access Forms (ActiveX component can't create the obj

B

Burnsie

Hi all,

I have a form that has hundreds of labels. When I click on a label I want
to be able to set the background color based on a selection made in an option
group. Instead of putting my code in every label's click event, I was hoping
to trap the label click event via WithEvents. However, I receive the
following message when my code tries to use WithEvents "ActiveX component
can't create the object." Any help would be greatly appreciated.

Thanks,

Burnsie

Here is my code (this code is in the form module and not a class module):

Option Compare Database
Option Explicit

Private WithEvents lblClicked As Label

Private Sub Form_Load()

Set lblClicked = New Label (This line is causing the error).

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top