Record navigation with scrollbutton

xWouterx

New member
Local time
Today, 11:54
Joined
Aug 14, 2007
Messages
7
Hello all
I have several forms which display records from the database. I put buttons on the forms to navigate to the first, last, previous, and next record. But I can also navigate through the records using my scrollbutton on my mouse... Now this is something I don't want, is there a way to disable the record navigation when the scrollbutton is used?

Kind regards

Wouter
 
This is a perennial problem with Access. In Access 97 there was a VB solution which workded well. Now you require a DLL.

However I worked out a workaround like this.

in the forms on open event

Me.AllowAdditions = False
DoCmd.ApplyFilter , "[ClientID] = 0" - Set this to name of the PK . I use an auto number so 1 does not exists this shows a form with no bound controls visible.

On the form place a new button and a save button.

in the new button use this line of code

Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec

in the save button use this

DoCmd.RunCommand acCmdSaveRecord
Me.AllowAdditions = False
 
Access 2007 has the ability to do this built in. For other versions you have to use an add-in. The Gold Standard for this for years has been Stephen Lebans hack.The sample database can be downloaded at:

http://www.lebans.com/mousewheelonoff.htm

Download and unzip the sample database into its own folder. Do whatever is necessary in your version of Windows to show Hidden Files. You should now have the ZIP file, the sample database, A2KMouseWheelHookVer22.mdb, and the MouseHook.DLL file. Go into the sample database and have a look around. When you’re ready, go into your database, and goto
File - External Data - Import and import the module modMouseHook from the sample database.

You then need to place a copy of the MouseHook.dll file in the same folder as your database.

In the first form to load in your db use this code:

Code:
Private Sub Form_Load()
   ' Turn off Mouse Scroll
    blRet = MouseWheelOFF
End Sub

Save everything then crank up your database and you should be set!
 
Thanks missinglinq, that worked for me, tried finding somethign with google but guess I used the wrong search criteria
 

Users who are viewing this thread

Back
Top Bottom