M
Mark A. Sam
Hello,
This procedure is on the Keypress event and limits the text going into a
textbox to allow a custom message (I understand that I can limit the len in
the table).
The problem I am having is that the line
[FieldText] = Left([FieldText], 20)
results in the last character typed only in the textbox. If I break
anywhere in the code, however it reassigns correctly so that the last 20
charaters typed are in the textbox.
Example: I if type in "This is a test 12345" that is 20 charaters. If I
then type the number 6, the textbox ([FieldText]) will contain only the
number 6. If I put a break in the code then resume, the textbox will
contain "This is a test 12345".
Private Sub FieldText_KeyPress(KeyAscii As Integer)
If Len([FieldText].Text) >= 20 Then
MsgBox "You cannot enter any more characters!"
[FieldText] = Left([FieldText], 20)
End If
End Sub
Thanks for any help and God Bless,
Mark A. Sam
This procedure is on the Keypress event and limits the text going into a
textbox to allow a custom message (I understand that I can limit the len in
the table).
The problem I am having is that the line
[FieldText] = Left([FieldText], 20)
results in the last character typed only in the textbox. If I break
anywhere in the code, however it reassigns correctly so that the last 20
charaters typed are in the textbox.
Example: I if type in "This is a test 12345" that is 20 charaters. If I
then type the number 6, the textbox ([FieldText]) will contain only the
number 6. If I put a break in the code then resume, the textbox will
contain "This is a test 12345".
Private Sub FieldText_KeyPress(KeyAscii As Integer)
If Len([FieldText].Text) >= 20 Then
MsgBox "You cannot enter any more characters!"
[FieldText] = Left([FieldText], 20)
End If
End Sub
Thanks for any help and God Bless,
Mark A. Sam