I've created a small sample database called "NumberPad.mdb" and placed it on
my website (
www.rogersaccesslibrary.com). You can download it from there if
you like.
Basically, do this: Create your buttons and name them cmd1 through cmd0
plus another called cmdBksp. Also, create a textbox for your SS number and
add an InputMask that does not save the dashes.
Now add the following code behind the form:
'-------------
Sub AddDigit(NewDigit As String)
If Len(Me.SSN & NewDigit) <= 9 Then
Me.SSN = Me.SSN & NewDigit
End If
End Sub
'-------------
Private Sub cmdBksp_Click()
On Error GoTo Err_cmdBksp_Click
If Len(Me.SSN) - 1 < 1 Then
SSN = Null
Else
Me.SSN = Left(Me.SSN, Len(Me.SSN) - 1)
End If
Exit_cmdBksp_Click:
Exit Sub
Err_cmdBksp_Click:
MsgBox Err.Description
Resume Exit_cmdBksp_Click
End Sub
'-------------
Private Sub cmd1_Click()
On Error GoTo Err_cmd1_Click
Call AddDigit("1")
Exit_cmd1_Click:
Exit Sub
Err_cmd1_Click:
MsgBox Err.Description
Resume Exit_cmd1_Click
End Sub
'-------------
Repeat the code for each of the other buttons based on cmd1, but replace
it's number.
--
--Roger Carlson
Access Database Samples:
www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L