From: paii, Ron on
I noticed a problem with Allen Browne's Access7 tip using the mouse wheel
event to scroll records in form view with Access 2010 beta. Access calls the
event twice for each move of the mouse wheel, which causes skipping over
records. I added code to check the count for each move of the wheel, then
count down to 1 before scrolling the records; which worked if the count is
the default of 3 on my mouse. After testing I switch the mouse driver to 6;
which required 2 turns of the mouse wheel per record. Access was not calling
the event once per count, It always called it twice. Modifying Allen's code
and placing it in the event solved the problem.

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error Resume Next

Static iWheelCount As Integer ' Call count

' Only scroll if in form view
If Me.CurrentView = 1 And Count <> 0& Then
If iWheelCount = False Then
iWheelCount = True ' Skip 1st call to sub for each move of
mouse wheel
Exit Sub
End If
iWheelCount = False

Err.Clear
If Me.Dirty Then
Me.Dirty = False
End If
Select Case Err.Number
Case 0&: ' OK
Case 3314&, 2101&, 2115& ' can't save record
MsgBox "Cannot scroll to another record, as this one cannot
be saved", _
vbInformation, "Cannot scroll"
Exit Sub
Case Else:
MsgBox "Cannot scroll" & vbCrLf & Err.Description,
vbInformation, "Cannot scroll"
Exit Sub
End Select

Err.Clear
RunCommand IIf(Count < 0&, acCmdRecordsGoToPrevious,
acCmdRecordsGoToNext)
If Err.Number = 2046& Then ' Can't move before first or after last
Beep
End If
End If

End Sub