Disable Scroll Wheel

C

CY

Is there any way I can disable the scroll wheel in one particular form?
User keeps throwing the form onto the next record with scroll when he really
wants to skip to next record only. I have tried a "On Scroll" event but
can't prevent it from going ot the next record. I can make it pop up a
message but it still goes to the next record, even when I say with the next
action 'Goto Record" and then the argument is Previous. Why????

TIA!!

CY
 
D

Douglas J. Steele

Assuming Access 2003 or earlier, you need something like the free
MouseHook.DLL file Stephen Lebans has at
http://www.lebans.com/mousewheelonoff.htm

(Note: it's not just as simple as installing the dll file. You need to take
a close look at the sample Stephen includes. There's a class module and some
other modules that need to be imported into your application, plus code that
has to be added to your form.)
 
C

CY

The problem with these is that it disables the mouse wheel for the entire
session and I only want to for one particular form. Also, I have created
this database for someone else who is hundreds of miles from me and who is
not computer savvy so I can't install a dll.

Maybe if I explain the situation someone can come up with a better
solution...

I have a main form with customer data.When you click a button on the main
form it opens a different form which, using a macro, copies the data
contained in one field over to the same field on the new form and thus
creates a new related record in another table. We want to be able to go
back and edit this one record later. If I set this new form to Allow Add
"no" it disables the mouse wheel, or prevents ANOTHER record being created,
but then when I click the original button from the main form, it doesn't
like that because of course it wants to open the form and create a new
record each time. I thought it would be simplest to just disable the wheel
but apparently that's not the case.

So I tried to create a macro that activates when the scroll wheel is used.
But somehow when I tell it to go back to record 1 when you scroll it ignores
that part of the macro - why?



It's frustrating to say the least...
 
D

Douglas J. Steele

Stephen's solution actually requires that you turn on the logic to stop the
mouse wheel from scrolling, and then turn it off when you're done. If you're
in a situation where you have multiple forms open at the same time and you
only want the mouse wheel not to work on Form A, you can put the code to
re-enable the mouse wheel in Form A's LostFocus or Deactivate event, and the
code to disable the mouse wheel in its GotFocus or Activate event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top