Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable mouse wheel from scrolling 2

Status
Not open for further replies.

turks393

Technical User
Dec 7, 2006
13
US
Is there an easy way to disable the mouse wheel from scrolling. I have a from for data entry and need to prevent people from scrolling. Can it just be added to the code?
 
turks393,
If your trying to prevent the user from moving to a new record by moving mouse wheel you can change the forms cycle property from All Records to Current Record.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Setting the Cycle Property to Current Record will keep from moving to the next record when using <Tab> or <Enter> to move thru a record, but it won't prevent the MouseWheel from moving to the next record!

A gentleman by the name of Stephen Lebans has a sample database that does this and 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 (I think that's the name) from the sample database.

Next, use your FIND feature in Windows to make sure you have the file MouseHook.dll on your PC. You should, it's a standard Windows file. You may have to go into Windows and select "Show hidden files" then run FIND. You need to place a copy of this file in the same folder your database resides in.

And finally, in the first form to load in your db use this code:

Code:
Private Sub Form_Load()
   ' Turn off Mouse Scroll
    blRet = MouseWheelOFF
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
why not create another query which sits in between your form and the forms datasource then set it to "top1". Once the user has completed the data entry, refresh the form query.



"Its not who you are that defines you, its what you do..." - Bruce Wayne
 
Here is what I use.


It requires no coding, but instead you just paste the active x control on the form when in design veiw. I don't know of Leban's version still allows scrolling of combo/list boxes, but mousetrap does.

You do however need to register the active x control on each machine that will be acessing the db, else you just get an error "No object in this control".
 
ActiveX controls, especially, but not limited to, "home grown" ones, are notorious for being hinky! And as you said, you do have to register it on ever machine that will be running it! This could make it particularly troublesome for a distributed application, where the developer might have little or no control after distribution. You deliver the app to a client, go on with your life, and two years later they decide to upgrade their computers and "Bam!" your app doesn't work anymore! Could take someone a really long time to figure out what went wrong with a custom ActiveX. And then, of course, there's the question of new versions of Access. The only version I saw mentioned at paperwalker was Access 97. Stephan has always kept his up to date with the latest version of Access. That'll no longer be necessary, of course, since after all these years, Micro$oft finally saw fit to address the problem themselves! Version 2007 has a built in function to handle all this.

Bottom line is I wouldn't be afraid to try it out on an in-house project that's never going out of my hands, but would be very leery of distributing it. I'd also be sure to make notes at the top of the code module on my main form, reminding that the control needs to be registered if machines are replaced.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top