Reprogram number keys?

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

Is it possible to "reprogram" the keypad keys to input
something other than the assigned number into a field?
For instance, could I fix it to enter "S" when I hit
the "1" key on the keypad? I suspect it would be an
If/then sequence that would "reveal" the "S" after update,
but was wondering if there is a way to make it appear
instantly (i.e. you would never see the "1" on the form,
just the "S" when you hit the "1").

Hope that's not too confusing.

Thanks in advance.
 
Assuming you're talking about using a form, you should be able to put logic
in the field's KeyPress event along the lines of:

Private Sub MyField_KeyPress(KeyAscii As Integer)

Select Case Chr$(KeyAscii)
Case "1"
KeyAscii = Asc("S")
Case Else
End Select

End Sub
 
-----Original Message-----
Assuming you're talking about using a form, you should be able to put logic
in the field's KeyPress event along the lines of:

Private Sub MyField_KeyPress(KeyAscii As Integer)

Select Case Chr$(KeyAscii)
Case "1"
KeyAscii = Asc("S")
Case Else
End Select

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)





.

Thanks, Doug, that was exactly what I needed! Works
great! Now, if you happen to visit this post again, I'd
like to know now to "program" the period/delete key on the
keypad to act like the delete key when the NumLock is set
(it will act like the period key when the NumLock is set,
but I don't want that.) Make sense?

I will also post this question separately as a new post,
since I know people don't often check back for responses
to their responses. Maybe you'll catch it there.

Jerry
 
I'm not sure there's any way of distinguishing between the period from the
number pad, and the period from the other part of the key. Unfortunately,
I'm using a laptop at the moment, with no number pad, so I don't have any
way of checking.
 
Back
Top