Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I change the "mouse-rollers" properties in a form?

Status
Not open for further replies.

bosarve

Programmer
Aug 7, 2001
20
0
0
SE
When I roll on the "mouse-roller" when I´m in a form I get to a new record. Is there some way to change it, so It will go to the next textbox in the same form??

There is people who will be confused when it changed so quikly.

Please help me! I sure there is some settings who can change this!!

bosarve@hotmail.com
 
I am not sure, but I believe either Access 2000 or Access XP have an on_scroll event which is designed for this function. However Access 97 does not. James Goodman
j.goodman00@btinternet.com
 
Goto the design of the form select properties, click the 'Other' tab and change the 'Cycle' to current record.

Nick
 
Nick!
It's not woking! When I roll on mouseroller I get to a new record!!

Other sugestions!!
 
Have seen your FAQ, but i realy don't understand to work with modules!!
 
Goto your database window, choose Modules and click New. Paste this in:
Declare Function CallWindowProc Lib "user32" Alias _
"CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Declare Function RegisterWindowMessage& Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String)
Public Const GWL_WNDPROC = -4
Public IsHooked As Boolean
Public lpPrevWndProc As Long
Public gHW As Long
Public Sub Hook()

If IsHooked Then
'MsgBox "Don't hook it twice without " & _
' "unhooking, or you will be unable to unhook it."
IsHooked = True
Else
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _
AddressOf WindowProc)
IsHooked = True
End If
End Sub
Public Sub Unhook()

Dim temp As Long
temp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
IsHooked = False
End Sub
Function WindowProc(ByVal hw As Long, ByVal uMsg As _
Long, ByVal wParam As Long, ByVal lParam As Long) As Long

If uMsg = GetMouseWheelMsg Then
' Debug.Print "Message: "; hw, uMsg, wParam, lParam
WindowProc = 0
Else
WindowProc = CallWindowProc(lpPrevWndProc, hw, _
uMsg, wParam, lParam)
End If
End Function
Public Function GetMouseWheelMsg() As Long
GetMouseWheelMsg = 522 'this works for Win98/2000, otherwise use
'RegisterWindowMessage("MSWHEEL_ROLLMSG")

End Function



Each form you use add this to the form_Load:

'Store handle to this form's window
gHW = Me.hwnd
If IsHooked Then
Call Unhook
End If

'Call procedure to begin capturing messages for this window
Call Hook

Add this to the form_Unload

Call Unhook


I haven't tried this myself as where I work this mouse scroll action must have been disabled. Keep posting if you have more troublw with it.

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top