It seems to work most of the time, but sometimes it messes up and I get the following error.
Runtime error '91' object variable or with block variable not set
The following line is highlighted when I try to debug it.
I put the following code in just about every form I have because many of them consists of data entry.
Option Compare Database
Private WithEvents clsMouseWheel As MouseWheel.CMouseWheel
Private Sub Form_Load()
Set clsMouseWheel = New MouseWheel.CMouseWheel
Set clsMouseWheel.Form = Me
Private Sub Form_Close()
Set clsMouseWheel.Form = Nothing
Set clsMouseWheel = Nothing
Private Sub clsMouseWheel_MouseWheel(Cancel As Integer)
MsgBox "You cannot use the mouse wheel to scroll records."
Cancel = True
I think the problem lies in the fact that sometimes these forms are open simultaneously or something.