Num Lock getting off by accident and creating problem in records

I use Microsoft Access in my business. I am having a problem with the Num lock key, it gets hit by accident and the keys on the keyboard start acting as Page Up, Down, etc which creates a problem when we are entering a new record.  For instance, I have a form to enter new Contracts, there are some fields that require numeric characters, but when the num lock key is hit by accident, and then a series of numbers are hit in the keyboard, then the form jumps to an older record, due to the num lock being off, and now this records can be changed.  For this reason the data in the older records have been changed as the employee keep hitting the numbers assuming num lock is on.  Is there any way to either make num lock always on even when the num lock key is hit, or something else that can be done within Microsoft Access?
Thanks in advance for the help.
camilo_gsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Irwin SantosComputer Integration SpecialistCommented:
Purchase a keyboard with the numlock far away from the keypad.

You can boot in the BIOS to startup with NUMLOCK on.. other than that you need to reinforce accuracy.
Craig YellickDatabase ArchitectCommented:
I found the following on MSDN.Microsoft.com

   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvbadev/html/chapter9retrievingsettingsysteminformation.asp

Supposedly you can control the NumLock state (amongst other key states) using some Windows API calls, though in my quick tests I didn't see any useful effect.  Per the above article, the state of the keyboard is stored in an array of bytes. You retrive the array as it presently exists, set or clear the byte for a specific key, then set it back.  NumLock, CapsLock etc are supposed to be controllable in this manner. I figured you could set the flag to True in your form code module.

Below, the relevant code.

Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long

Private Sub SetKeyState(key As Integer, state As Boolean)
  Dim keys(0 To 255) As Byte
  GetKeyboardState keys(0)
  keys(key) = CByte(Abs(state))
  SetKeyboardState keys(0)
End Sub

My idea was to set the form's KeyPreview to True, then constantly set NumLock=true whenever a key was pressed.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  Call SetKeyState(vbKeyNumlock, true)
End Sub

Unfortunately the WinAPI call did not raise any errors but didn't seem to work, either. Maybe someone else will come up with a fix.

-- Craig
samb39Commented:
This guy recommends using keytweak to just map the numeric keypad keys to the keys above the letters.

http://www.mcse.ms/archive164-2005-5-1639033.html

Get keytweak here:

http://webpages.charter.net/krumsick/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
camilo_gsAuthor Commented:
Thanks for your help samb39, it worked pretty well.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.