マウスホイールでスクロール(仮)
Accessでテキストボックス内で、スクロールをさせようとしても、スクロールしません。
レコード移動を避けるために、動こないようになっているようですが、
ホイールで動かしたくなるのは、慣れているからなのか、仕方ない。
検索したけど、見つからず・・・。
改行位置を検索して、移動させるというので、ホイールでカーソルが移動することで、
仮想的にスクロールバーが動くようになりました。
もっといい方法があれば、教えてほしいです。
フォームのプロパティ>マウスホイール使用時のイベントプロシージャに
以下のモジュールを読むようにして、動くようにしています。
Sub MouseAction(Count As Long, MyForm As Form, Target As String) Dim FocusedTB As TextBox Dim CousorPosition As Long Dim CountTxt As Long Dim i As Long Dim FocusedCtrl As Control Set FocusedCtrl = MyForm.ActiveControl If TypeName(FocusedCtrl) <> Target Then Exit Sub End If CountTxt = Len(Nz(FocusedCtrl)) CousorPosition = FocusedCtrl.SelStart If CountTxt = 0 Then Exit Sub End If If Count > 0 Then If CousorPosition = 0 Then CousorPosition = 1 End If i = InStr(CousorPosition, FocusedCtrl, vbCrLf) If i = 0 Then FocusedCtrl.SelStart = CountTxt Else i = i + 1 FocusedCtrl.SelStart = i End If ElseIf Count < 0 Then If CousorPosition = 0 Then Exit Sub End If i = InStrRev(FocusedCtrl, vbCrLf, CousorPosition) If CousorPosition <> i + 1 Then If i > 0 Then i = i + 1 End If Else If i > 0 Then i = InStrRev(FocusedCtrl, vbCrLf, i) End If If i > 0 Then i = i + 1 End If End If FocusedCtrl.SelStart = i End If End Sub