Mouse Wheel Scroll through records not working (1 Viewer)

Tieval

Still Clueless
Local time
Today, 01:21
Joined
Jun 26, 2015
Messages
475
Just to add to the problem, I have used the previously mentioned code and it works perfectly, however I have a secondary sub-form showing part of the record.

The sub-form updates using the Form_Current event:
Code:
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error GoTo eWM
 If Not Me.Dirty Then

   If (Count < 0) And (Me.CurrentRecord > 1) Then

     DoCmd.GoToRecord , , acPrevious

   ElseIf (Count > 0) And (Me.CurrentRecord <= Me.Recordset.RecordCount) Then

        DoCmd.GoToRecord , , acNext

   End If

 Else

   MsgBox "The record has changed. Save the current record before moving to another record."

 End If
 
eWM:
    Err.Clear 'Stop overshoot when no new record capability

End Sub

Private Sub Form_Current()
Me.Parent.Controls![frmSub2].Requery
End Sub
Unfortunately this causes error 2118 - you must save the current record before you run the requery action.

Any clues?
 

Tieval

Still Clueless
Local time
Today, 01:21
Joined
Jun 26, 2015
Messages
475
For anybody interested, I solved this as follows:

Code:
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error GoTo eWM
 If Not Me.Dirty Then

   If (Count < 0) And (Me.CurrentRecord > 1) Then

     DoCmd.GoToRecord , , acPrevious

   ElseIf (Count > 0) And (Me.CurrentRecord <= Me.Recordset.RecordCount) Then

        DoCmd.GoToRecord , , acNext

   End If

 Else

   MsgBox "The record has changed. Save the current record before moving to another record."

 End If
 
eWM:
    Err.Clear 'Stop overshoot when no new record capability

End Sub

Private Sub Form_Current()
DoCmd.RunCommand acCmdSaveRecord
Me.Parent.Controls![frmSub2].Requery
End Sub
 

topdillon

New member
Local time
Yesterday, 17:21
Joined
Sep 27, 2017
Messages
1
Count is the number of lines to scroll from settings. So...

Code:
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error GoTo eHndl
    For i = 1 To Abs(Count)
        DoCmd.GoToRecord , , IIf(Count > 0, acNext, acPrevious)
    Next
eHndl:
    Err.Clear
End Sub

This is what works for me. It jumps to the record at the end of the wheeling. If I wheel for one tick, it goes 2 records away. If I wheel 6 ticks, it goes 12 records away. This is great as usually use the wheel to speed up visually finding a record.

Code:
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error GoTo eHndl

   DoCmd.GoToRecord , , IIf(Count > 0, acNext, acPrevious), Abs(Count)
   
eHndl:
    Err.Clear
End Sub
 

ted.martin

Registered User.
Local time
Today, 00:21
Joined
Sep 24, 2004
Messages
743
In Ridders post above, DevHut suggests that MS will distribute a fix in Sept17. I have not seen it yet. Does anyone have anything further on this? Thanks
 

bignose2

Registered User.
Local time
Today, 01:21
Joined
May 2, 2010
Messages
219
I started this post & generally happy with using the code (in fact prefer)

however what I have noticed on a few of my PC's I use a marble trackball.

This does not seem to be picked up in the code so tries to scroll the windos as before but as we now know with its bugs it does not work, just moves the box & nothing in the form moves.

Does anyone know of software or way that it might work with a trackball.

I have the MS marble and its driver. You can set it to click one of the extra buttons & it goes into scroll mode.

I would like it to be picked up with the VBA code like it does for a normal mouse.
 

Users who are viewing this thread

Top Bottom