Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Unanswered: Mouse wheel trying alternative solution

    Sorry this is my first post here, so please be gentle.

    I've read the solution to the mouse scroll problem, where the mouse wheel allows someone to scroll through all the records in single form view and I wish to stop this.

    I know I can use the Leban's solution
    http://www.dbforums.com/microsoft-ac...use-wheel.html

    Or the Microsoft solution
    ACC2000: How to Detect and Prevent the Mouse Wheel from Scrolling Through Records in a Form

    However, I do not want to use DLLs, so I was seeking an alternative solution. I have the advantage that it is really only one form that is causing me the problem, so this may not work for everyone.

    I already have a hidden form with the Login name on it. So I add a label or text box for the record identifier number. I then can update that using code

    Function ChangeRec(myRecordID As Integer)
    Forms!FmLogin.Form!txtRecId = myRecordID
    End Function

    Then construct a query that has all the fields from the underlying table, but which chooses the record on the table using the value on Forms!FmLogin.Form!txtRecId, i.e.

    SELECT tWhatever.*
    FROM tWhatever
    WHERE (((tWhatever.ID)=[Forms]![FmLogin]![txtRecId]));

    Then make this the recordsource of your form.

    Then to stop the person scrolling to a new record on the Form properties tab stop record additions. If you need to use the form to add records, then this is either going to have to be coded or on a different form (the allow additions and recordsource could be changed via VBA, but that would mean someone would be able to scroll, but perhaps data entry could be used).

    Now when you wish to open the form rather than using filter you use the ChangeRec() function to change the ID and open the form.

    This appears to work.

    Now I have done this on a textbox, but I'm presuming that a label caption would be just as good.

    Please can anyone see any pitfalls with this approach, other than.

    All references that open the form need to be changed.
    A solution needs to be found for adding records.
    Each form that requires changing will need to have the same process followed, which could be laborious.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Here's a couple of examples you can look at:

    http://www.dbforums.com/6303048-post52.html

    I believe the 2nd example does not use the *.dll file (or module.)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    Many thanks, I copied over the second example without the dll file and it did not work on Access 2002 and requested the mousehook.dll file.

    I don't fully understand the Leban's solution but the solution I posted earlier from the Microsoft website should work. The problem is that it requires the mousehook.dll file to be on the computer. Sharing Access applications across the organisation is fine but once you start installing dll files on people's computers it causes problems with internal IT policies and installers.

    The main summary of the code before if scrolling through records causes you a problem, and it is more likely to be a problem on a single rather than continuous form, then see if you can reduce your recordsource to just the record that you wish, rather than filtering.

    When I searched I did not find this solution proposed elsewhere.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Yes. I have the same problem with the *.dll. I had a solution years ago and I'm going to try and dig it up (as I need to change some of the mdb files on our system to not use the *.dll mousehook file.)

    I'll try to post it in the code bank once I found out how I did it before.

    Right now, I'm simply using the On Mouse move event of the form and experimenting with code behind that event (to cancel other events, etc..). It may help for an interum solution in your case.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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