Stop records from changing when using a scroll mouse on a form

  • Thread starter Thread starter BZeyger
  • Start date Start date
B

BZeyger

I have a form that contains numerious text fields from a table. When I scroll
the mouse wheel, the records change. Is there a way to turn off this option?
 
Doug,

I thought the form's Cycle property, when set to "Current Record," would
prevent the wheel from shifting off the current record. Is that not the
case?

Larry
 
I found a limited solution. In my databases I typically have one form that
displays a list of records and then users doubleclick on the one they want to
open. That in turn opens a detailed form that is filtered to that one record
only. Even then we were having a problem with the mousewheel causing the
form to go to a new record. We thought we could fix that by setting the
AllowAdditions property to No, but for some reason when you have a filter
applied, Access ignores the AllowAdditions property and allows them anyway.
What finally did work was this bit of code in the OnCurrent event:

DoCmd.GoToRecord acActiveDataObject, "YourFormNameHere", acFirst

Essentially what happens is when someone goes to use the scrollwheel to
scroll down, it immediately puts you back to the first (and only) record.
Scrolling up doesn't have any effect anyway when there's just one record.
The record will update when the user tries to scroll so if you have any code
that runs on an update event or a dirty event, this may not work for you, but
I've found it works well for me in most cases.

David Allison
 
Back
Top