Well, I can think of several reasons..... first of all, say you wanted a form to give a timed test (say trivia, or IQ, or whatever), and every 20 seconds or so, it goes to the next record, well, you wouldn't want the person taking the quiz to be able to go back through and change answers using mouse scroll.
Another example of why one would disable mouse-scroll...... say you have 2 sides to database entry...... The first side people start the record, and then the 2nd side people finish it up, based on first come first serve. Well, you wouldn't want people to be able to scroll through to the easy records leaving the hard records for everybody else. The 2nd side people would be entering new data perhaps into a subform.
Yet another example, using single form method, and adding new records. Say you have a person receiving money as charity, he fills out a form with the donater's name, ssn, amount donated, and then when all info is correct, it prints a receipt, then it starts a new record. At the end of the day, you wouldn't want your data-entry clerk to view all of the social security numbers, nor would you want them to be able to change the donation amount. (Say they wanted to steal $100, they could mouse scroll and change the donated amount by $100)
I could go on and on, but the main reason for locking out the mouse-scroll is for data integrity in one way or another. I mean, you wouldn't want a user to accidently scroll to another record while they think they're filling out a different record. Those are just some examples of why you would want to lock the mouse, and add new records at the same time.
I think we're getting into a pissing match.
I never claimed it to be a cure all all though I'm sure I can devise a way to use the method that would address the concerns you've raised.
Rather than be a burden to you all with my post I'll just delete it -![]()
it's really not like that at all........I was just trying to point out instances where making it data-entry and locking to one record, would not be enough. Obviously, most people won't have a use for disabling mouse scroll in the majority of their databases, but occassionally, there is a need.
![]()
AOG123,
I was wondering if you could help me out here. I'm not a VB user and I have someone helping me with this.
I have used what you paste on the mouse scroll lock and I have gotten two lines that are red. Could you please tell me what I am doing wrong...
I have copied and paste all 3 codes you have written into my VB script.Code:Option Compare Database Option Explicit Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _ (ByVal lpPrevWndFunc As Long, _ ByVal hwnd As Long, _ ByVal msg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long Public Const GWL_WNDPROC = -4 Public Const WM_MouseWheel = &H20A Public lpPrevWndProc As Long Public CMouse As CMouseWheel
Please advise.
Thank you.
Hi, and welcome to the forum,
Have you downloaded the example? You find a zip file attachment at the bottom of this page DeveloperBarn Forums - View Single Post - Disabling Mouse Scroll
You can import the modules from this attachment and see how the form events work.
- 2 modules,
Forms Events
- Load,
- Close and
- MouseWheel_MouseWheel
If i helped you, make me famous by clicking the
I have downloaded the .zip file. I have copied it to my code screen and I have gotten the two red lines. I guess something is missing there.
jmurrayhead
If you agree, give me rep.
If you like it here...throw us a few bones to help support us.
What operating system are you using, and what version of Office?
Can you post your entire VBA segement?
I want to thank everyone for their help. AOG123 is currently helping me with this. Thank you.![]()
Bookmarks