Full Version: Scroll wheel on a form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
TimFPMD
I have several forms in a database that allow the user to select a record to display on the form by choosing a name in a combo box. The user can then read, add, delete, and edit the data on the form for that person. Unfortunately, some users have allowed their index finger to rest on the mouse scroll wheel, and have accidently scrolled from one name to another without realizing it - thus potentially changing the data for the wrong name! Any suggestions as to how I can prevent this? I have tried setting the "cycle" property for the form to "current record", but that doesn't prevent the problem...
missinglinq
A gentleman by the name of Stephen Lebans has a sample database that does this and it 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:

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.
Keaian
hmm.. the cycle property didn't work? You set this on the form or subform bound by the cbobox?

I would check to make sure that the form itself has this property checked. I would be at a loss on to why it would still be happening if this was set to Cycle Current Record.

alternative. create a on mouse wheel event.

msgbox "Hey Capurnicus, Stop moving the mouse wheel",vbokonly

lol.. but that would just let them know they are messing with it.
missinglinq
The Cycle property doesn't prevent the mousewhheel from scrolling thru records. This problem has been around since the invention of the (mouse) wheel! Stephen Lebans solution has been the gold standard for years now in addressing the problem. Microsoft finally, in version 2007, addressed the issue and you can control it thru a form property setting.

Edited by: missinglinq on Wed Apr 8 16:41:34 EDT 2009.
TimFPMD
Thanks, that did the trick!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.