Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2006
    Posts
    3

    Thumbs up Unanswered: Sol. 2: How to control mouseWheel on a countinuous form whithout loosing any record

    Hi friends,

    Firstable, let say Hello and that I'm Spanish, so forgive my english

    I was searching for a solution to an m.access problem and found out that nobody knew how to solve it so I crumpled my brain and found the solution by myself, but as I've found useful information here, I would like to share something with the comunity:

    The problem is when the user use the mouse wheel, once the first record disappears out of sight, the user will not be able to make it appear again (the record is not deleted, just can't see it until the user open the form again), at least he use the arrow buttons of the scroll.

    Sorry, I posted wrong codes before. Those are the right codes!!! (didn't control a pair of things...)

    '************************** CODE *************************

    Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal count As Long)
    finalRecord = me.CurrentRecord + count
    numRegs = me.Recordset.RecordCount

    If numRegs = 0 Then
    'do nothing
    ElseIf finalRecord =1 or finalRecord=0 Then
    me.Recordset.MoveFirst
    me.Requery
    ElseIf finalRecord > 1 And finalRecord <= numRegs Then
    me.Recordset.Move (count)
    Else
    me.Recordset.MoveLast
    End If
    End Sub

    '************************ END CODE ************************


    With that simple code you don´t have to disable mouse wheel on that forms

    You can perform a public sub on a module and just call that sub at any mousewheel event on your continuous forms. Just notice the mousewheel "count" param is byVal, so your public sub should be something like that:

    '************************** CODE *************************

    Public Sub controlMouseWheel(myForm As Form, ByVal count As Long)
    finalRecord = myForm.CurrentRecord + count
    numRegs = myForm.Recordset.RecordCount

    If numRegs = 0 Then
    'do nothing
    ElseIf finalRecord = 1 or finalRecord=0 Then
    myForm.Recordset.MoveFirst
    myForm.Requery
    ElseIf finalRecord > 1 And finalRecord <= numRegs Then
    myForm.Recordset.Move (count)
    Else
    myForm.Recordset.MoveLast
    End If

    End Sub

    '************************ END CODE ************************


    I hope it will help you. Please let me know if you're happy to find it

    See you!
    Last edited by julieAnne; 08-06-06 at 22:20.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •