disable the mousewheel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mseo
    New Member
    • Oct 2009
    • 183

    disable the mousewheel

    hi
    I need to know how to disable the mousewheel, I have forms where the users must open on new records for entry
    appreciate any suggestions
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    I'm sorry, but I don't get the correlation between needing to disable the wheel and opening the form to a new record!

    As to the disabling of the mousewheel, if you're running Access 2007, you already have a function that addresses this issue! Just check with Help.

    For all other versions, you'll need some outside help. A gentleman by the name of Stephen Lebans has a sample database that does this and it can be downloaded at:



    First, download and unzip the db and take a look. Go into your db and goto File > External Data > Import and import the module modMouseHook from the sample database. Next make sure you have the included file, MouseHook.dll, in the same folder your database resides in. The following code needs to run before the mousewheel will be locked:
    Code:
    Private Sub Form_Load()
     'Turn off Mouse Scroll
     blRet = MouseWheelOFF
    End Sub
    If you have one form that always loads first in your db, place the code there. If the first form to load varies, place the same code in each form.

    You should be set now.

    Concerning the opening on a new record for data entry, if you wnatusers to only be able to enter new records, you can set the form's DataEntry Property to Yes. This will allow entry of new records but will not allow access to existing records.

    To allow both, use this code in the Form_Load event
    Code:
    Private Sub Form_Load()
      DoCmd.GoToRecord , , acNewRec
    End Sub
    Linq ;0)>

    Comment

    • mseo
      New Member
      • Oct 2009
      • 183

      #3
      thanks,missingl ing
      I tried your approach it seems that I can not implement it correctly with access 2003
      I tried this and I need to know your point of view about it
      1- I declared public variable as boolean
      Code:
      Public mouseno As Boolean
      2- on before update
      Code:
      Private Sub Form_BeforeUpdate(Cancel As Integer)
      If mouseno = True Then
      MsgBox " mousewheel disabled .", vbOKOnly + vbInformation
      Cancel = True
      mouseno = False
      End If
      end sub
      Code:
      Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
      mouseon= True
      End Sub
      thank you very much
      I really appreciate your help

      Comment

      • ahmedtharwat19
        New Member
        • Feb 2007
        • 55

        #4
        Best Example To Hook Mouse Wheel Without Dll File.

        Hi mseo,
        Best Example To Hook Mouse Wheel Without Dll File.

        Try It.

        Ahmed Tharwat(Medo)
        Attached Files

        Comment

        • Chel
          New Member
          • Mar 2017
          • 1

          #5
          This code is working properly.Thank u so much.
          You make my days happy.

          Comment

          Working...