J
Jeff
Hello,
What I am looking for is a way to limit a user to having more than 127
characters in a Text Box. I know the simple way is to have an Input Mask.
But I dont want to use the Input Mask Property, I can explain why if needed.
So one way I know you can is in the KeyDown Event...
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Len(txtNotes.Text) > 126 And Then KeyCode = 0
End Sub
This works if the user tries to TYPE more than 127 characters. But it does
not help if the Users COPIES and PASTEs text into the Field. So for example
if there are 100 characters in there & they Copy some large text from
somewhere else & then Right click & Paste into this one it will take it. How
can I prevent this from happening ? But want to allow to Paste if total is
less than 127 characters.
I know I can also use the BeforeUpdate & AfterUpdate Events to trim down the
large amount of Text after the fact, but what I prefer is to just not allow
it from the begining.
So some way to prevent users from Pasting more than 127 Characters.
Any help would be greatly appreciated.
Thank You,
Jeff
What I am looking for is a way to limit a user to having more than 127
characters in a Text Box. I know the simple way is to have an Input Mask.
But I dont want to use the Input Mask Property, I can explain why if needed.
So one way I know you can is in the KeyDown Event...
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Len(txtNotes.Text) > 126 And Then KeyCode = 0
End Sub
This works if the user tries to TYPE more than 127 characters. But it does
not help if the Users COPIES and PASTEs text into the Field. So for example
if there are 100 characters in there & they Copy some large text from
somewhere else & then Right click & Paste into this one it will take it. How
can I prevent this from happening ? But want to allow to Paste if total is
less than 127 characters.
I know I can also use the BeforeUpdate & AfterUpdate Events to trim down the
large amount of Text after the fact, but what I prefer is to just not allow
it from the begining.
So some way to prevent users from Pasting more than 127 Characters.
Any help would be greatly appreciated.
Thank You,
Jeff