K
Keith G Hicks
A2k.
I'm using the following to mask an unbound text box so that the user can
ONLY enter 50 characters:
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
I seem to recall this is a problem with access since this also means that
editing in that control means that typing in the middle of the string
overwrites characters regardless of the how the keyboard key "Insert" is set
(on or off).
I need to limit the # of charactes AS the user types. I do NOT want to Trim
the characters afterward, nor do I want to pop up some lame warning in the
BeforeUpdate event or in the ValidationRule property. That's dumb. How can I
limit the number of characters in an UNBOUND control AS the user types
without screwing up the insert behavior? There ought to be a "MaxChars"
property on text boxes.
So here's what I did and it seems to work peachy (and I removed the
"CCCCC..." mask):
Private Sub CertHolderName_KeyPress(KeyAscii As Integer)
If Len(Me.CertHolderName) > 50 Then
KeyAscii = 0#
End If
End Sub
Is that the best solution?
Thanks,
Keith.
I'm using the following to mask an unbound text box so that the user can
ONLY enter 50 characters:
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
I seem to recall this is a problem with access since this also means that
editing in that control means that typing in the middle of the string
overwrites characters regardless of the how the keyboard key "Insert" is set
(on or off).
I need to limit the # of charactes AS the user types. I do NOT want to Trim
the characters afterward, nor do I want to pop up some lame warning in the
BeforeUpdate event or in the ValidationRule property. That's dumb. How can I
limit the number of characters in an UNBOUND control AS the user types
without screwing up the insert behavior? There ought to be a "MaxChars"
property on text boxes.
So here's what I did and it seems to work peachy (and I removed the
"CCCCC..." mask):
Private Sub CertHolderName_KeyPress(KeyAscii As Integer)
If Len(Me.CertHolderName) > 50 Then
KeyAscii = 0#
End If
End Sub
Is that the best solution?
Thanks,
Keith.