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
 
Top