Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    7

    Unanswered: Problem with mousewheel.dll and disabling scroll record on multiple forms

    So I wanted to disable scroll records on all my forms so I did what Microsoft suggested here: ACC2000: How to Detect and Prevent the Mouse Wheel from Scrolling Through Records in a Form

    It seems to work most of the time, but sometimes it messes up and I get the following error.

    Code:
    Runtime error '91' object variable or with block variable not set
    The following line is highlighted when I try to debug it.
    Code:
    clsMouseWheel.SubClassUnHookForm
    I put the following code in just about every form I have because many of them consists of data entry.

    Code:
    Option Compare Database
    Option Explicit
    
    Private WithEvents clsMouseWheel As MouseWheel.CMouseWheel
    
    Private Sub Form_Load()
        Set clsMouseWheel = New MouseWheel.CMouseWheel
        Set clsMouseWheel.Form = Me
        clsMouseWheel.SubClassHookForm
    End Sub
    
    Private Sub Form_Close()
       clsMouseWheel.SubClassUnHookForm
       Set clsMouseWheel.Form = Nothing
       Set clsMouseWheel = Nothing
    End Sub
    
    Private Sub clsMouseWheel_MouseWheel(Cancel As Integer)
        MsgBox "You cannot use the mouse wheel to scroll records."
        Cancel = True
    End Sub
    I think the problem lies in the fact that sometimes these forms are open simultaneously or something.

    Anyone know why and how to fix this?

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I think there is something about this in the code bank. Have a look and see what you can find.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •