Limit Size Of Text Box

COB

Registered User.
Local time
Today, 19:18
Joined
Mar 7, 2003
Messages
19
Hi all.
Just a quick question..
How do you limit the amount of text that a person inputs into a text box?
Thanks a million in advance.
COB
 
In design view of the table, look at the Properties (at the bottom of the page). The first one is called Field Size. When the data type of your field is Text, there will be a number here (Access will default to sometimes 50 and sometimes 255). Enter the max number of characters you want in here. Max is 255 for a text field.
 
Thanks Ally and Rich
But unfortunately I'm using Access 97 and there doesn't seem to be a field in the properties section with Field Size, is there any alternatives.
Thanks in Advance.
COB
 
Rich and I both use '97 although it's the same in 2000. In design view of the table, look down near the left hand side and there's two tabs. One called General and the other Lookup. Field Size is the first property under General. If you can't see it, you're probably not in design view of your table!
 
Ah I see whare the problem is sorry lads,I probably didn't explain it properly!!

I'm trying to set the size of text within a text box on a form..Sorry about that..

Cob
 
and what they mean, is if the textbox is linked to a field in a table - change it in the table's design.
 
Unfortunately the text box is not connected to any table!!!
The topic gets harder!!!
Sorry lads
Cob
 
If it's not connected to a table, what function is it having? You know that it won't save any information if it's not related to a table?

(BTW I'm a ladette)!
 
Even if I could modify the table design, just for an example I had an number which could only be 5 numbers long how could I do that when the options are :Byte Integer, Long int,double etc???
Thanks
Cob
 
My appologies to you Ally, I didn't mean to cause offense. Blame it on my Irish up bringing.. The text box takes in a a 5 long number and performs mathematical equation on it..
Thanks and Sorry
Cormac
 
You could work out the lowest (eg 10000) and highest numbers you would ever enter (eg, 99999) and in the Validation Rule (a bit further down on the General properties tab), type:

Between 10000 And 99999
 
Last edited:
I found a solution to the problem..
I ended up having to use VBA and converting the textbox value to a string, then finding the length of the string.. It works!!!

Public Function LimitSize()
Dim X
Dim Y

Let X = text1.Text
Let Y = (Len(X))
If Y >= 10 Then
MsgBox "Size limited to 10 characters!!"
End If
End Function

Rgds
Cormac
 

Users who are viewing this thread

Back
Top Bottom