Limiting a text box size (1 Viewer)

yhgtbfk

Registered User.
Local time
Tomorrow, 02:11
Joined
Aug 30, 2004
Messages
123
I dont know what its called so I didnt know what to search for.

Basically, I have resized a text box. I dont want the user to type beyond that length.

What do I turn on or off to prevent this?
 

llkhoutx

Registered User.
Local time
Today, 10:11
Joined
Feb 26, 2001
Messages
4,018
You have several alternatives:

(1) Test the length of what's been entered with the Len function. You'll get an error for inputting more characters in the field.
(2) Use the KeyPress event to count the characteres entered, character by character.
(3) Use the Validation Rule property for the field in the underlying table.
(4) Use the Validation Rule property for the form field.
 

yhgtbfk

Registered User.
Local time
Tomorrow, 02:11
Joined
Aug 30, 2004
Messages
123
llkhoutx said:
You have several alternatives:

(1) Test the length of what's been entered with the Len function. You'll get an error for inputting more characters in the field.
(2) Use the KeyPress event to count the characteres entered, character by character.
(3) Use the Validation Rule property for the field in the underlying table.
(4) Use the Validation Rule property for the form field.

Thank you very much. I might try the first two.
But....

By length I didnt mean character length. I meant as in:

If I set the length to be 5cm, when the user types in it, they cant type more than 5cm worth of characters.

Normally as you type beyond the length of the text box, you can still type, and just see the last bit of what you typed.

What I want to do is limit the text box so once you hit 5cm, nothing more can be typed.

If this is too hard, I will estimate how many characters can fit in the box (by typing all 0s or Ws) and then limit the length to that
 
R

Rich

Guest
Set the field size to limit the number of characters that can be typed into the text box
 

yhgtbfk

Registered User.
Local time
Tomorrow, 02:11
Joined
Aug 30, 2004
Messages
123
Rich said:
Set the field size to limit the number of characters that can be typed into the text box

Thank you...

But if it is an unbound textbox?
 

ghudson

Registered User.
Local time
Today, 11:11
Joined
Jun 8, 2002
Messages
6,195
Use the BeforeUpdate event of the text box in question to count the number of characters keyed using the Len() function.
 

Users who are viewing this thread

Top Bottom