Results 1 to 2 of 2

Mouse scroll in text box AND form

  1. #1
    veejay is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Nov 2018
    Montreal, Canada

    Question Mouse scroll in text box AND form

    So I have a form which is slighlty longer than the screen so I use the mouse scroll to go up and down in my form.
    I also have a textbox which has scrollbar set to vertical.

    I'm trying to come up with a way to scroll the textbox when focus is on (or when I hover with the mouse).

    I tried this little bit of code I found online :

    Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
         Dim i As Long
         Dim s As String
         If Me.ActiveControl.Name = "NOTES" Then
             If Count > 0 Then
                 For i = 1 To Count
                     s = s & "{DOWN}"
                 Next i
                 For i = 1 To -Count
                     s = s & "{UP}"
                 Next i
             End If
             SendKeys s
         End If
     End Sub
    But it cause the form to jump up and down.

    Any solutions?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    Well, the form has to be sized so vertical scroll bar not needed then scrolling in textbox is perfect. Thank you.

    Made a slight change that won't fix your issue, but might be of interest.

    First set Tag property of controls want to allow mouse scroll with "Scroll". Then code:

    If Me.ActiveControl.Tag = "Scroll" Then

    Also tested without the If conditional and scroll only takes place in textbox having the capability. The code does execute but has appearance of nothing happening. So for performance sake, use the If condition.
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-31-2017, 04:16 PM
  2. Replies: 1
    Last Post: 10-10-2014, 10:22 AM
  3. Replies: 1
    Last Post: 02-03-2014, 09:41 AM
  4. Replies: 5
    Last Post: 05-08-2013, 04:17 PM
  5. Replies: 1
    Last Post: 06-02-2009, 04:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Tech Forums: Microsoft Office Forums