473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MouseWheel Off: Code not working

Dököll
2,364 Expert 2GB
Hey Gang!

Can you have a look tell me what you see happening?

Below code should turn MouseWheel off, right!

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  3.    Select Case KeyCode
  4.       Case 33, 34
  5.          KeyCode = 0
  6.    End Select
  7. End Sub
  8.  
  9.  
My mousewheel still works with above code. Perhaps it is more specific to buttons!



I am getting a weird error when I run below. Any ideas!

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Load()
  3.     Dim blRet As Boolean
  4.     blRet = MouseWheelOFF(False)
  5. End Sub
  6.  
  7.  
It looks like the error is saying MouseWheelOff is not defined. But it isn't true because blRet is defined.

What are your thoughts?

Also, I picked up this link through our help pages:

http://www.thescripts.com/forum/thread632608.html

Will I need to do this as another option?

Thanks for your help!

Dököll
Nov 16 '07 #1
6 2019
Rabbit
12,516 Expert Mod 8TB
The mousewheel, as far as I know, doesn't trigger the KeyDown event because it doesn't represent the pressing of a key. For a packaged solution, you can google Leban's .dll solution for this.

If you want it confined to Access itself, I developed a process that locks down all forms of record navigation except for custom created buttons. Although I think this can easily be adapted to affect only the mousewheel with some tweaking of the code.
Nov 16 '07 #2
missinglinq
3,532 Expert 2GB
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 can be downloaded at:

http://www.lebans.com/mousewheelonoff.htm

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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. ' Turn off Mouse Scroll
  3. blRet = MouseWheelOFF
  4. End Sub
If you have one form that always loads first in your db, like a menu form or a splash screen, place the code there. If the first form to load varies, place the same code in each form. You should now be set!

Linq ;0)>
Nov 16 '07 #3
Dököll
2,364 Expert 2GB
Thanks to you both, funny you sent me in the same direction, sound like it is pretty common problem.

Will give it a whirl, thanks again:-)
Nov 17 '07 #4
missinglinq
3,532 Expert 2GB
It is and has been since the advent of the mouse wheel; my response was from a boilerplate file I keep just to answer this question! It's amazing to me that it's taken Micro$oft this long to finally address the problem!

Linq ;0)>
Nov 17 '07 #5
Dököll
2,364 Expert 2GB
Works like a charm guys, thanks, saves us a world of trouble...

Have a wonderful week-end!

Dököll
Nov 18 '07 #6
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Nov 18 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: deko | last post by:
Is it possible to disable the mouse wheel WITHOUT using a DLL? I've looked at Microsoft Knowledge Base Article 278379 (http://support.microsoft.com/default.aspx?scid=kb;en-us;278379), which...
2
by: Jack | last post by:
Hi all, I searched the archives and found everyone happy with Stephen's MouseWheel On/Off code except for those with subforms. Stephen's page indicates that he has added code to handle subforms...
3
by: Steve | last post by:
is there an event for the mousewheel? I have turned off navigation buttons but the mousewheel still allows it. i have a form that allows new entries and when it opens up, automatically goes to...
6
by: Roger Uribe | last post by:
There are references to using the wndproc form sub to trap and swallow the mousewheeel events - but they don't get there when a combobox (or many other controls) has the focus.. Yet the MSDN does...
1
by: Qwert | last post by:
Hello, when a NumericUpDown control has the focus, the mousewheel increases/decreases its value. How does one prevent this from happening? How does one turn off its mousewheel event? Thanks.
1
by: Nicholas Shewmaker | last post by:
(I apologize if this posts twice. My AVG is being fussy.) From what I've read, MouseWheel is a very tricky event. I have replaced my Python tcl84.dll and tk84.dll files with those in the...
3
by: Dave K | last post by:
I seem to be missing something... I want to use a mousewheel event in my VB.NET app... and there's a lot of example code on the net showing how to use the mousewheel event... and the .NET docs...
0
by: WaterWalk | last post by:
Hello. When I tried to make Tkinter canvas widget respond to MouseWheel event on Windows XP, I failed. The canvas just doesn't receive MouseWheel event. I used bind_all to find out which widget...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
In a database search application (vb2005), the user wants to be able to scroll through records using the mousewheel. The data display form contains textboxes for the main data and a datagridview...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.