Text box won't scroll with mouse wheel (1 Viewer)

add1989

Registered User.
Local time
Today, 21:27
Joined
Jun 3, 2010
Messages
25
Hi all,

Got a small problem with my text box. There is enough text in the text box that a vertical scroll bar has appeared. My mouse wheel will scroll other parts of access, but not the text box in form view.

I know that Microsoft disabled Mouse Wheel in form view for record changing, but it's a bit of a nuisance not being able to scroll a text field.

Is there an option I can change? Or can anybody contribute some clever VB code to fix it?

I'm using Access 2007.

Adam
 

boblarson

Smeghead
Local time
Today, 13:27
Joined
Jan 12, 2001
Messages
32,059
Nope, no options for that one. Anyone wanting to scroll it will need to use the scroll bars on the text field. Sorry.
 

FREDDY67

Registered User.
Local time
Today, 21:27
Joined
Apr 23, 2007
Messages
52
Adam

The only way I know of is to use 'SendKeys' which can cause problems but personally I haven't encountered any problems with this example, more experienced users will be able to explain the issues with 'SendKeys'.

I have attached a small db to show code in action, I didn't write this code & therefore all credit goes to the original author if I could remember where I found it.

Hope it helps.

FREDDY67
 

Attachments

  • MouseScroll.zip
    15.2 KB · Views: 1,569

missinglinq

AWF VIP
Local time
Today, 16:27
Joined
Jun 20, 2003
Messages
6,420
Also note that in addition to the problem using SendKeys, mentioned in passing by Freddy67, which involves the NumbersLock Key being triggered, Allen Browne reports
Unless previous versions of Access are also installed, macros (in 2007) that use Sendkeys may fail with the message:

The SendKeys action requires the Microsoft Office Access Utility Add-in to be loaded.
Linq ;0)>
 

Kinger43

racecar driver
Local time
Today, 16:27
Joined
Aug 17, 2007
Messages
226
How do I get the mouse wheel to scroll to the previous/next record in Access 2007? I tried putting a GoToRecord command in the On Mouse Wheel event but this will only go to the the next/previous record (depending on which was specified in code) regardless of which direction the mouse wheel is scrolled. I really want to be able to navigate records with the mouse wheel on this particular form.
 

Kinger43

racecar driver
Local time
Today, 16:27
Joined
Aug 17, 2007
Messages
226
Works like a charm! Thanks!
Could you tell me what the argument "Count" is? I understand Me means the active form and that Count is a Long but what does Count mean?
 

eggieman

New member
Local time
Today, 13:27
Joined
Apr 6, 2012
Messages
1
I changed the code a little. It now reacts even more like the normal textboxes.

Count gives the number of lines to scroll (according your windows setting)

Public Const WM_VSCROLL = &H115
Public Const WM_HSCROLL = &H114
Public Const SB_LINEUP = 0
Public Const SB_LINEDOWN = 1
Public Const SB_PAGEUP = 2
Public Const SB_PAGEDOWN = 3


Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
Dim LinesToScroll As Integer
If ActiveControl.Properties.Item("controltype") = 109 Then
Dim hwndActiveControl As Long
hwndActiveControl = fhWnd(Screen.ActiveControl)
If Count < 0 Then
For LinesToScroll = 1 To -1 * Count
SendMessage hwndActiveControl, WM_VSCROLL, SB_LINEUP, 0
Next
Else
For LinesToScroll = 1 To Count
SendMessage hwndActiveControl, WM_VSCROLL, SB_LINEDOWN, 0
Next
End If
End If
End Sub
 

Users who are viewing this thread

Top Bottom