Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a Text box to 255 characters?

Status
Not open for further replies.

coryras

Programmer
May 8, 2003
9
US
How can you set a text box to only allow a person to type in up to 255 characters from the form.
 
Set the value for the field size in the underlying table that the text box is bound to to 255.

----
A program is a spell cast over a computer, turning input into error messages.
 
I already have it set to 255 in the table. My problem is on the form I want to only allow the user to be able to type in that many charcters because if they type in more than that the program blows up.
 
Ok, what version and OS are you using? I just tested again (Office and XP OS) and once the field size is set in the table, the form based on that field does not allow more characters then the "Field Size" setting. You may have another problem. Any code associated with the form or field?

----
A program is a spell cast over a computer, turning input into error messages.
 
Are you sure the textbox is bound to a field?

Ed Metcalfe.

Please do not feed the trolls.....
 
On the On Exit function of the text box you could use this code:

If Len([txtBox]) > 255 Then
MsgBox "Please limit the text to 255 characters.", vbInformation, "Text too long"

Hope this helps!

Brenda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top