Problem with mouse roller

G

Guest

In Access 2000, on a data entry form, when I roll the mouse roller (as in
selecting from a dropdown list or at any other time that the roller is
moved), the form automatically enters the information from the form and
redisplays a blank form. Is there any way to prevent the mouse roller from
misbehaving? Thanks.
 
G

Guest

I tried Lebans and couldn't get it to work for me. My VBA skills (or lack
thereof) may be at fault. Any other ideas or what I may be doing wrong with
Lebans.
 
G

Guest

It isn't just you. it did not work for me either

Jim Osborne said:
I tried Lebans and couldn't get it to work for me. My VBA skills (or lack
thereof) may be at fault. Any other ideas or what I may be doing wrong with
Lebans.
 
G

Guest

I installed Labans VBA code in the form at the "On Load" event, saved the
"MouseHook.dll" in the same folder as my .MBD file, then opened the database,
opened the form and tested the mouse wheel. This did not correct my problem.
I tried installing the VBA code in a number of different locations, but
nothing seems to work. Help, please!!
 
G

Guest

Yes, I imported this module into my db. Is there something that needs to be
done to "activate" or "execute" this module? Thanks.
 
K

Ken Snell [MVP]

I've not had difficulties with Stephen's excellent solution.

This is from another thread where a user seemed to be having similar
problem -- he solved it this way:

My form where i set up the command buttons for turning mouse wheel on and
off included a line of code that was providing a text message and this was
the problem.
So, I removed the following two lines
Me.txtStatus.Value = "The MouseWheel is turned OFF except for ListBox
controls, TextBox controls with ScrollBars and the Record Navigation
control"
&
Me.txtStatus.Value = "The MouseWheel is turned ON"

I guess this may have been obvious to many...but if not I hope this helps
someone else.

Thanks again,
Monish
 
S

Stephen Lebans

Why don't you post all of the code behind the form in question so I can see
what is going on..

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen,

Here is the code from my form. As I mentioned earlier, my VB skills are
low, so any help you can provide will be greatly appreciated.

----------------------------------------------------------------------------------

Option Compare Database

' Copyright Lebans Holdings 1999 Ltd.
' www.lebans.com
' You are free to use the MouseHook.dll in any of your applications,
' whether personal or commercial providing you are not selling this DLL
' by itself or as part of a collection.

' You must copy the MouseHook.dll file into either your
' Windows System folder or into the same folder where this MDB resides.
' If you are distributing Front End/Back End MDBs then ensure that the
' MouseHook.dll file is copied to the same folder where the FRONT END MDB
resides.
' The MouseHook.dll is NOT an ActiveX DLL that must be registered.
' Just copy the DLL to one of the folders as indicated above.



Private Sub Command14_Click()
' Turn the MouseWheel Off
Dim blRet As Boolean
' Call our MouseHook function in the MouseHook dll.
' Please not the Optional GlobalHook BOOLEAN parameter
' Several developers asked for the MouseHook to be able to work with
' multiple instances of Access. In order to accomodate this request I
' have modified the function to allow the caller to
' specify a thread specific(this current instance of Access only) or
' a global(all applications) MouseWheel Hook.
' Only use the GlobalHook if you will be running multiple instances of Access!
blRet = MouseWheelOFF(True, False)
Me.txtStatus.Value = "The MouseWheel is turned OFF except for ListBox
controls, TextBox controls with ScrollBars and the Record Navigation control"
End Sub




Private Sub Command28_Click()
On Error GoTo Err_Command28_Click


' Screen.PreviousControl.SetFocus
' DoCmd.FindNext

Exit_Command28_Click:
Exit Sub

Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click

End Sub
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click


DoCmd.Close

Exit_Command17_Click:
Exit Sub

Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click

End Sub
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click


DoCmd.Close

Exit_Command19_Click:
Exit Sub

Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click

End Sub
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click


DoCmd.Quit

Exit_Command20_Click:
Exit Sub

Err_Command20_Click:
MsgBox Err.Description
Resume Exit_Command20_Click

End Sub
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

Exit_Command23_Click:
Exit Sub

Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click

End Sub
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click

Dim stDocName As String

stDocName = "Texas City Supply - Loaded Railcars"
DoCmd.SendObject acReport, stDocName

Exit_Command24_Click:
Exit Sub

Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click

End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click

Dim stDocName As String

stDocName = "Railcar Movement Request"
DoCmd.SendObject acReport, stDocName

Exit_Command25_Click:
Exit Sub

Err_Command25_Click:
MsgBox Err.Description
Resume Exit_Command25_Click

End Sub
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-CAT"
DoCmd.RunMacro stDocName

Exit_Command26_Click:
Exit Sub

Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click

End Sub
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-SPP"
DoCmd.RunMacro stDocName

Exit_Command27_Click:
Exit Sub

Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click

End Sub

Private Sub Command29_Click()
On Error GoTo Err_Command29_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-GAR"
DoCmd.RunMacro stDocName

Exit_Command29_Click:
Exit Sub

Err_Command29_Click:
MsgBox Err.Description
Resume Exit_Command29_Click

End Sub
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-ROB"
DoCmd.RunMacro stDocName

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click

End Sub
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-Cancel"
DoCmd.RunMacro stDocName

Exit_Command31_Click:
Exit Sub

Err_Command31_Click:
MsgBox Err.Description
Resume Exit_Command31_Click

End Sub
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command33_Click:
Exit Sub

Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click

End Sub
Private Sub Command34_Click()
On Error GoTo Err_Command34_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.Description
Resume Exit_Command34_Click

End Sub
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub
Private Sub Command36_Click()
On Error GoTo Err_Command36_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-Cancel"
DoCmd.RunMacro stDocName

Exit_Command36_Click:
Exit Sub

Err_Command36_Click:
MsgBox Err.Description
Resume Exit_Command36_Click

End Sub
Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

Dim stDocName As String

stDocName = "Railcar Movement Request-Cancel"
DoCmd.RunMacro stDocName

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub

Private Sub Detail_Click()

End Sub


Private Sub Command16_Click()
' Turn the MouseWheel On
Dim blRet As Boolean
blRet = MouseWheelON
Me.txtStatus.Value = "The MouseWheel is turned ON"
End Sub

Private Sub Form_Load()

End Sub
 
S

Stephen Lebans

Jim search your computer for all instances of the MouseHook DLL file. Make
sure the DLL only exists in the same folder as your MDB for now. If this
doesn't work then try copying the DLL to your System32 folder.
Now reboot your computer.

Open my sample MDB and make sure the MouseWheel can be started and stopped.
Close my sample MDB

Open your MDB
Test the MouseWheel to ensure you can start and stop

Let me know how you make out.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen,

Thanks for your reply. I have only one instance of the MouseHook DLL on my
PC. It is located in the same folder as my .mdb file.

I tried your sample DB and it works fine. In fact, if I stop the mouse
wheel from your sample DB, then open my DB, the mouse wheel in my DB is also
stopped.

Is there a way to execute your code when the form (or DB) opens instead of
having to click a button (On Open???) I tried adding an "OpenModule" command
to my Autoexec but I have been unable to get it to work. I believe my
problem is in the VB code, and I don't know enough about VB to get it to work.

Any help is greatly appreciated. I'm very frustrated at this point.
 
S

Stephen Lebans

Jim you need to look at the code behind my sample Form.


The code at the top of the form in the General Declarations area must be
duplicated in your form.

Copy the code currently behind the my sample form's Load event into the LOAD
event of your form.

Copy the code currently behind the CommandButton on my sample form into the
LOAD event of your form. Make sure it appears AFTER the existing code in the
Load event that you just copied over in the previous step.

Finally, you need to only perform the above steps to one single form in your
application. Generally it would be the form you open first and close last.

Get as far as you can with the instructions. If you get stuck, post back
here and copy & paste all of the code in your form's class module.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen,

Thanks for your help. I finally got it to work "on load". It appears that
the import of the modMouseHook module was failing, but no error message was
received. To get it to work, I did a copy-and-paste of the code for the
module from your example DB to my DB. It works as expected. Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top