Monitoring Controls Using WithEvents
Posted on 2011-02-22
I want to monitor all textboxes on a form without creating event handlers for each one.
The method below works in Excel but I can't seem to get it to work in Access.
Public WithEvents ValueBox As Access.TextBox
Private Sub ValueBox_Click()
Private ValueBoxes As Collection
Private Sub Form_Load()
Dim FCT As clsFormControl
Set ValueBoxes = New Collection
Set FCT = New clsFormControl
Set FCT.ValueBox = Me.MyTextbox
Set RFC = Nothing
With this in place, clicking on MyTextbox should cause a messagebox to display. But it doesn't. Any thoughts?
For reference the form is bound to a query and is read only. I don't think that matters, but you never know.