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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a max size for a text field in a form 2

Status
Not open for further replies.

sync123

Programmer
Jul 20, 2003
32
US
Hi,

I have a form that users use to enter data into a table. I want to limit the size of
some of the textboxes in my form.

Reading prev related posts ppl had mentioned that instead of restricting the size of the text field change the length in the table field for the form.

I cannot do this since I have a phone field in my table and in my form I have broken up the phone field into 3 parts. Is there any way to set the max size for a textfield
So I would like to set the sizes of the three parts of my phone field in the form to 3,3, and 4 respectively.

Thanks
 
Sure you can. In the Input Mask property of the field put this in:

000;;_

Add an extra zero for your 4 digit field. Hope this helps.

:)WB
 
Thanks wabeg! That works! But I have a question for you. When I click on the field I get these ____ .They go away when I enter something. Is it because of the _ after the ; in the input mask. Any other way around this w/o getting the _ in the beginnning

sync123
 
Can the same input mask be used for fields that expect text instead of numbers. Like if I have a name field which I want to limit to 50 characters. Would I have to put 50 0's followed by 2 semicolons for the input mask?
Thanks.
sync123
 
Use this instead then:

000;;" "

To limit the text fields for your name issue you will have to limit it on your server with field length.


:)WB
 
I tried that but I think access thinks I have already entered data into the field if I use a " " .It doesn't allow me to add anything to the field I believe it thinks i have passed the 3 digit limit. Any other ideas?
Sync123
 
I just tried it again and it worked fine for me. Are you tabbing to the begining of the field? Also what version of Access are you using? I am using Office XP.

The character after the semicolons is to let the user know how many more character they have left to go. So adding a space character shouldn't reduce the size of input mask.

Why not just use # to let the user know it is a number field?

:)WB
 
Thanks for your help wb.

When I tab to the field it works fine but when I click on the field with the mouse for some reason the cursor moves to the end of the field and shows __ in the box. It's not a big deal but i'm wondering why this is happening. I am using access97.
Thanks
sync123
 
If you are not tabbing to the field then you will get what you are seeing. In my application I will make the masked fields right justified so the cursor pops in the front as users usually click in the begining of the field. Hope this makes sense.

:)WB
 
Just out of curiosity, sync123, why did you break up your phone number on the form into three parts instead of using one control with the generic telephone mask? While Access doesn't ALWAYS have the best answer to a given problem, it usually does.

The Missinglinq

"It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Hi wabeg,

You mentioned that you make your field left justified.In design view of the form I made the telephone field left justified but the cursor still moves to the end when I click on the textbox. Is there any way to force the cursor to start at the beginning.
Thanks,
sync123
 
Actually, it should be RIGHT justified. If you do this way you will have not problems, hopefully.

:)WB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top