Personalized keypad for touch screen data entry (1 Viewer)

daniel2126

Registered User.
Local time
Today, 06:44
Joined
Jul 25, 2013
Messages
20
I have the following code on the keypad form. The number from 1 to 9 work fine but I don't have any idea on creating the code form the decimal (.) and backspace.

I'm running on Access 2007... any suggestions ???

Private Function TypeAlphaNum(strKey As String) As String
Screen.PreviousControl.SetFocus
Me.Controls(Screen.ActiveControl.Name).SelStart = Nz(Len(Me.Controls(Screen.ActiveControl.Name)), 0)
Me.Controls(Screen.ActiveControl.Name).SelLength = 0
Me.Controls(Screen.ActiveControl.Name).Value = Me.Controls(Screen.ActiveControl.Name).Value & strKey
End Function
Private Sub Key_0_Click()
TypeAlphaNum "0"
End Sub
Private Sub Key_1_Click()
TypeAlphaNum "1"
End Sub
Private Sub Key_2_Click()
TypeAlphaNum "2"
End Sub
.
.
.
.
Private Sub Key_9_Click()
TypeAlphaNum "9"
End Sub
 
For the backspace, I'd probably send a character or something that couldn't otherwise be sent. Test for that character in the function, and if that character is passed, reduce the length of the string by one (testing for it already being empty of course).

Why doesn't sending a "." work for the decimal?
 
Not following this thread, just giving my 2 cents.

For consistency use the key code constants:
Code:
Private Sub TypeAlphaNum(intKeyCode As Integer)
    Screen.PreviousControl.SetFocus
    With Me.ActiveControl
'        /* Is this necessary?
'        .SelStart = Len(.Value)
'        .SelLength = 0
'       */
        .Value = .Value & Chr(intKeyCode)
    End With
End Sub

Private Sub Key_0_Click()
    TypeAlphaNum vbKey0
End Sub
https://msdn.microsoft.com/en-us/library/aa243025(v=vs.60).aspx
 

Users who are viewing this thread

Back
Top Bottom