Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll disable 4

Status
Not open for further replies.

directorz

Technical User
Mar 4, 2003
142
0
0
US
Hello experts,
Is there a way to limit a form to show only 1 record by disabling the scroll feature of a mouse wheel while in the form

Thank you
Directorz
 
Hi this is a tricky one.

The only solution I can come up with so far is to:
Set a filter on the form which is released in code
when a "Next record" buton is pressed.
Put this in your button klick event

Me.Painting = False 'Stop the screen from flickering
Me.FilterOn = False 'Release filter and youre back to rec #1
Me.Bookmark = myBookmark 'Get back to where you where
Me.MoveNext
myBookmark = Me.Bookmark 'Remember where to go next time
Me.Filter = "[YourPrimaryKeyName]=" & Me.YourPrimaryKey
Me.FilterOn = True 'scrolling disabled
Me.Painting = True

For this to work make sure you don't Requery or you'll loose youre bookmark.
This is from top of my head, hope it'll work without too much trouble.


 
xmad4,
I took a peek at that solution. I had some trouble with it. I was able to disable the mouse but it seemed that everytime I exit the program and re-start, the mouse was abled again.

Jollygood,
I'll run some samples with yours

thank you

Directorz
 
I've never actually used this solution but I would assume you would want to call:

Code:
Dim blRet As Boolean
blRet = MouseWheelOFF

sometime on app or form startup, maybe the form OnOpen event
 
Xmad4, I put this is in the Form_Open event and it did not work. JL
 
Yes, I had some similar problems. I really did not find too much consistency. I belive I followed the instructions.

Directorz
 
I have now come up with another way of solving this problem and it can be read att: [blue]faq702-5263[/blue].

Thanks directors for inspiring me to look in to this mater once again and forcing me to come up with a more graceful solution than before. (I hope it is ;-) )

jollygood
 
Jollygood, Wow, I'm going to try this one. I'll let you know.

The other one from xmad4 requires some module coding. I got it to work but it's not consistent. It fires up but there are certain situations when it does not work:

Dim blRet As Boolean
blRet = MouseWheelOFF

Maybe the next version of Access will include this as an option...

Directorz
 
Jollygood,
All I am able to get is 'ambiguous name _mouse wheel' and a bunch of errors...
Directorz
 
I'm sorry to hear directorz.

I've implemented it in an app that I'm developping and it works great. I've even managed to make Access not displaying
the info message. To the user it looks like the form is just ignoring the mouse wheel for the main form, but they can still use it in a sub datasheet/continous form.

I know the logics are some what difficult to follow but it works in Access 2002. That I'm sure off.

So I guess I have to explain the trick in a better way in my faq. At the moment im in short of time but if you like I could send you an example mdb.

The error you mentioned is most likely caused by you creating an event procedure for "Form_MouseWheel" from the Access properties dialog and then copying another one into it from the faq. Try deleting the one automaticaly created by Access.

It works. And if you want me to help you with it just let me know.
jollygood
 
Yes, I could use a hand. I will try to keep the dialog at a
minimum
 
Jollygood,
I see it. I'm at another computer, don't know why my other one would not see it. Interesting! I'll get back with you.

Directorz
 
I've been extemely busy. OK, I ran some things, set up as you suggest in the sample db. My problems start on your third line: Private Sub Form_Error...

I receive 'Expression On Error produced ambiguous name Form_Error

By the way, your setup functions flawlessly. I appreciate your making it available. Where am I erroring?

Directorz
 
directorz
The error is exactly what it says. You have declared a procedure more than once wich is forbidden. I sugest that
you step through your form code and remove one of the procedures that ,in this case, looks like this:
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
..
etc
"Form_Error" is the name of the procedure and the above is it's declaration. Next time you get an error like this. Make sure you have installed the Office XP Help files for Access/VBA. They don't by default. And then you can klick the Help button on the error dialog, and mostly you get very helpful information on that error and how to solve it.

jollygood
 
Jollygood,
I have corrected the problem...there was a duplicate as you indicate...the error issue is no longer there. Awesome! 2 others however. I am using a multi tab form. The unbound textbox was placed on the first tab of the form. While on the second tab, if I attempt a scroll, I'm taken back to the first tab where the textbox is located. I will try to remove the tab stop...this should prevent this?. Also, on closing the form a pop up appears and says "Access, underneath that is a number '2169' and a box that says 'OK'. Any thoughts. Other than that, all appears OK. I do have the help file installed. Thank you so much.
Directorz
 
Jollygood,
I've experimented with your scheme in my db and have had a problem with error 2169. I note that in yours, the same error can be produced. I am befuddled (I think that's a word) on how to handle this. Any thoughts?

Directorz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top