By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,536 Members | 2,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,536 IT Pros & Developers. It's quick & easy.

Mouse scroll is going to a new record (and I don't want it to!)

P: 68
Hi!!
I have a subform with a comments (memo) field, linked to a form.

On the Memo field:
Properties-Other-Enter Key Behavior = New Line in Field

On the subform:
Properties- Other- Cycle = "Current Record"

Subform and Form are linked on an ID field.

One ID should never have more than one comments box, therefore I do not want my subform to tab or scoll to new records (or there will be a dupe record error).
I updated the 'Cycle' property to prevent tabbing to a new record, but discovered that the mouse scroll button scrolls to a new record. Arg. It's resonable to expect that they would use their mouse scroll on this memo field, but how can I prevent it from scrolling to a new record?

Thanks!
May 4 '07 #1
Share this Question
Share on Google+
6 Replies


maxamis4
Expert 100+
P: 295
Disable Mouse Scroll
I ll have to get back to you with the code since it is at home. In the mean time search

mouse scroll+access+disable

in google, it should be out there its an old code that was developed years ago for that purpose.
Hi!!
I have a subform with a comments (memo) field, linked to a form.

On the Memo field:
Properties-Other-Enter Key Behavior = New Line in Field

On the subform:
Properties- Other- Cycle = "Current Record"

Subform and Form are linked on an ID field.

One ID should never have more than one comments box, therefore I do not want my subform to tab or scoll to new records (or there will be a dupe record error).
I updated the 'Cycle' property to prevent tabbing to a new record, but discovered that the mouse scroll button scrolls to a new record. Arg. It's resonable to expect that they would use their mouse scroll on this memo field, but how can I prevent it from scrolling to a new record?

Thanks!
May 4 '07 #2

missinglinq
Expert 2.5K+
P: 3,532
Stephen Lebans has a sample database that does this and can be downloaded at:

http://www.lebans.com/mousewheelonoff.htm

Download and unzip the db and take a look. Go into your db and goto
File > External Data > Import and import the module modMouseHook (I think that's the name) from the sample database.

You'll need to find a copy of MouseHook.dll on your PC and copy it into the same folder as your database resides in. Locate it using Find. It may be a hidden file; if you can't locate it using Find, unhide all files then search again.

In the first form to load in your db use this code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.    ' Turn off Mouse Scroll
  3.     blRet = MouseWheelOFF
  4. End Sub
May 5 '07 #3

JConsulting
Expert 100+
P: 603
Another option would be to place a no duplicate index on the ForeignKey in your memo field table.

ID (autonumber)
ParentID (foreign key with index)
MemoField (memo)

It will let you scroll there...mousewheel or no...but won't ever save more than the first entry.
J
May 6 '07 #4

P: 68
Another option would be to place a no duplicate index on the ForeignKey in your memo field table.

ID (autonumber)
ParentID (foreign key with index)
MemoField (memo)

It will let you scroll there...mousewheel or no...but won't ever save more than the first entry.
J

Beyond not wanting to SAVE multiple entries, I need them to not even be able to ENTER multiple entries. (I don't want them to type a bunch of notes in, then say that it cannot be saved because it has scrolled to a new record and now it's a dupe). Thanks!
May 7 '07 #5

JConsulting
Expert 100+
P: 603
Beyond not wanting to SAVE multiple entries, I need them to not even be able to ENTER multiple entries. (I don't want them to type a bunch of notes in, then say that it cannot be saved because it has scrolled to a new record and now it's a dupe). Thanks!
Hmmm, How about uing the form to disallow additions if there is already 1 entry?

Put this on your Main form. Change the name of your subform in the code

Private Sub Form_Current()
Dim rs As Object
Set rs = Me.subfrm1.Form.RecordsetClone ' Change subform name here
If rs.RecordCount > 0 Then
Me.subfrm1.Form.AllowAdditions = False ' Change subform name here
Else
Me.subfrm1.Form.AllowAdditions = True ' Change subform name here
End If
End Sub
May 7 '07 #6

P: 52
I have spent several hours working on this issue myself, and I just figured it out. I just saw this post, so I want to contribute to the community by adding an additional solution to the problem. Go to your subform's properties, then go to "Event", then add an "[Event Procedure]" where it says "On Current". Next, type the following code:

Private Sub Form_Current()
If Form.currentRecord <> 1 Then
DoCmd.GoToRecord , , acPrevious
End If
End Sub

Works every time! If you have other code in your form_current sub, add it to an "else" clause right before where it says "End If". This doesn't require any dll downloads or anything, just 3 lines of code.
Sep 11 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.