Text box won't scroll with mouse wheel

add1989

Registered User.
Local time
Today, 19:42
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
 
Nope, no options for that one. Anyone wanting to scroll it will need to use the scroll bars on the text field. Sorry.
 
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

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)>
 
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.
 
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?
 
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

Back
Top Bottom