![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've used Dbase/Clipper for years & Access for a little while now but Access doesn't seem to have any elegant solution to limiting the size of a text box ... i.e. the max number of characters that can be entered into a text box. In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line elegant solution .. @ row, col get variable picture "@R50" or ... I could say var1=space(50) Now when I try to enter data into var1 it will allow a max of 50 characters. Why don't the Access team make a small property specifying the max num of characters enterable ? I have seen Allen Browne's solution: http://allenbrowne.com/ser-34.html I was just wondering if there's anything better. I tried using the format property with "C" repeated say 30 times ... but when entering data into the box I now see an underline/underscore over which I have to type ... looks ugly ! Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? Thx & Best Rgds, Prakash. |
#3
| |||
| |||
|
|
I've used Dbase/Clipper for years & Access for a little while now but Access doesn't seem to have any elegant solution to limiting the size of a text box ... i.e. the max number of characters that can be entered into a text box. In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line elegant solution .. @ row, col get variable picture "@R50" or ... I could say var1=space(50) Now when I try to enter data into var1 it will allow a max of 50 characters. Why don't the Access team make a small property specifying the max num of characters enterable ? I have seen Allen Browne's solution: http://allenbrowne.com/ser-34.html I was just wondering if there's anything better. I tried using the format property with "C" repeated say 30 times ... but when entering data into the box I now see an underline/underscore over which I have to type ... looks ugly ! |
|
Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? |
| Thx & Best Rgds, Prakash. |
#4
| |||
| |||
|
|
Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? |
#5
| |||
| |||
|
|
Is there some reason why you do not define the Field in the Table with the maximum length you desire? If you do, and use that Field as the Control Source of a TextBox on a Form, you will only be able to enter as many characters as are defined. Also, it sounds as if you are using an Input Mask. Most of us use Input Masks rarely, if ever, because, except when input is being keyed and the user tabs from one Text Box to another, they can seem "quirky" as you describe. Is it possible that you want Access TO BE DBase/Clipper to the extent that you haven't expended the time and effort to learn "The Access Way"? Expecting one software package to act/respond exactly or very similarly to another is just inviting frustration. Larry Linson Microsoft Office Access MVP prakashwadhw... (AT) gmail (DOT) com> wrote in message news:cd6b9ec2-a73c-4ac5-94dc-f49459f9e39a (AT) s8g2000prg (DOT) googlegroups.com... I've used Dbase/Clipper for years & Access for a little while now but Access doesn't seem to have any elegant solution to limiting the size of a text box ... i.e. the max number of characters that can be entered into a text box. In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line elegant solution .. @ row, col get variable picture "@R50" or ... I could say var1=space(50) Now when I try to enter data into var1 it will allow a max of 50 characters. Why don't the Access team make a small property specifying the max num of characters enterable ? I have seen Allen Browne's solution: http://allenbrowne.com/ser-34.html I was just wondering if there's anything better. I tried using the format property with "C" repeated say 30 times ... but when entering data into the box I now see an underline/underscore over which I have to type ... looks ugly ! Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? Thx & Best Rgds, Prakash. |
#6
| |||
| |||
|
|
prakashwadhw... (AT) gmail (DOT) com wrote: I've used Dbase/Clipper for years & Access for a little while now but Access doesn't seem to have any elegant solution to limiting the size of a text box ... i.e. the max number of characters that can be entered into a text box. In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line elegant solution .. @ row, col get variable picture "@R50" or ... I could say var1=space(50) Now when I try to enter data into var1 it will allow a max of 50 characters. Why don't the Access team make a small property specifying the max num of characters enterable ? I have seen Allen Browne's solution: http://allenbrowne.com/ser-34.html I was just wondering if there's anything better. I tried using the format property with "C" repeated say 30 times ... but when entering data into the box I now see an underline/underscore over which I have to type ... looks ugly ! Not sure why you are using Format. If you click under the data tab you can use an InputMask. Here's an example of limiting to 5 characters with no guide. CCCCC;;" " Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? I'm not aware of a solution. That doesn't mean there isn't one. If I entered in the GotFocus events If len(Me.TextFieldName) > 5 then Me.TextFieldName.SelStart = 5 Me.TextFieldName.SelLength = 2 Endif and I tabbed to the field then the insertion point would be at the fifth character and the 5th/6th chars would be selected. ICGirlshttp://www.youtube.com/watch?v=HJ0pABDh_gw Thx & Best Rgds, Prakash. |
#7
| |||
| |||
|
|
You could try: #1 - The number of characters you type into a text box will be limited by the size of the text field in the table. If you only want 15 chars, then you define the table field as 15 characters. #2 - There is a input mask. (you mention that you might be using the "format" of the text box...try using the input mask...you might find it better). If you have a unbound text box, or for the simple reason you want restrict the number of characters into a text box, simply use a input mask. Bring up the form in design mode, highlight the text box, display the properties sheet, and then go to the data tab, you see a property called input mask. put your cursor into that property, and hit f1 for help. A few simply examples: AAAAAAAAAAAA (allow any 12 characters, including space) 999999999999 (allow only numbers, including spaces) ???????????? (allow only letters, no numbers). Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? There are workarounds, but keep in mind that word, Excel, and even web based forms have this problem. This is really much the issue of using standard windows interface as anything else. You can write code to try and change this behavior, but in a sense you breaking just about how every windows program functions. I usually just click on the field BEFORE the one I want, and then hit tab key. You could likely put some code on the fields "got focus" event, but then your applications will enslave you to have to do this coding for every field (users will expect that behavour -- this is a lot of work). Note that you *can* change the behavior of what happens when you tab into a field (select all of field, go to start of field, or go to end of field -- you find this global option in tools->options->keyboard tab). It is not ideal that when you click on a text box, your cursor is not put to the start, or end..but that just the way all text boxes on windows has worked since windows 3.1 in 1991 came out. You can always double click on the actual text to select the whole field. Another common key (standard to windows) is to hit f2 to select, and then f2 again to jump to the start of the field.. -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada pleaseNOOSpamKal... (AT) msn (DOT) com |
#8
| |||
| |||
|
|
There are 3 UNBOUND textboxes on this form for which I'd like the foll behaviour: if the text box is empty, then whenever the text box gets focus, the cursor should go to the 1st character ... else it should follow the default behaviour. Would it be possible for either you or anyone else on this NG to please post some sample code which would permit me to do this ? |
#9
| |||
| |||
|
|
prakashwadhw... (AT) gmail (DOT) com wrote: I've used Dbase/Clipper for years & Access for a little while now but Access doesn't seem to have any elegant solution to limiting the size of a text box ... i.e. the max number of characters that can be entered into a text box. In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line elegant solution .. @ row, col get variable picture "@R50" or ... I could say var1=space(50) Now when I try to enter data into var1 it will allow a max of 50 characters. Why don't the Access team make a small property specifying the max num of characters enterable ? I have seen Allen Browne's solution: http://allenbrowne.com/ser-34.html I was just wondering if there's anything better. I tried using the format property with "C" repeated say 30 times ... but when entering data into the box I now see an underline/underscore over which I have to type ... looks ugly ! Not sure why you are using Format. If you click under the data tab you can use an InputMask. Here's an example of limiting to 5 characters with no guide. CCCCC;;" " Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? I'm not aware of a solution. That doesn't mean there isn't one. If I entered in the GotFocus events If len(Me.TextFieldName) > 5 then Me.TextFieldName.SelStart = 5 Me.TextFieldName.SelLength = 2 Endif and I tabbed to the field then the insertion point would be at the fifth character and the 5th/6th chars would be selected. ICGirlshttp://www.youtube.com/watch?v=HJ0pABDh_gw Thx & Best Rgds, Prakash. |
#10
| |||
| |||
|
|
On Feb 25, 10:42 pm, Salad <o... (AT) vinegar (DOT) com> wrote: prakashwadhw... (AT) gmail (DOT) com wrote: I've used Dbase/Clipper for years & Access for a little while now but Access doesn't seem to have any elegant solution to limiting the size of a text box ... i.e. the max number of characters that can be entered into a text box. In Dbase/Clipper eg. if memory serves me correctly, it's a 1-line elegant solution .. @ row, col get variable picture "@R50" or ... I could say var1=space(50) Now when I try to enter data into var1 it will allow a max of 50 characters. Why don't the Access team make a small property specifying the max num of characters enterable ? I have seen Allen Browne's solution: http://allenbrowne.com/ser-34.html I was just wondering if there's anything better. I tried using the format property with "C" repeated say 30 times ... but when entering data into the box I now see an underline/underscore over which I have to type ... looks ugly ! Not sure why you are using Format. If you click under the data tab you can use an InputMask. Here's an example of limiting to 5 characters with no guide. CCCCC;;" " Also ... when I click in the text box, the cursor goes somewhere in the middle of the text box & I have to press the home key to go to the beginning. Is there any workaround for this ? I'm not aware of a solution. That doesn't mean there isn't one. If I entered in the GotFocus events If len(Me.TextFieldName) > 5 then Me.TextFieldName.SelStart = 5 Me.TextFieldName.SelLength = 2 Endif and I tabbed to the field then the insertion point would be at the fifth character and the 5th/6th chars would be selected. ICGirlshttp://www.youtube.com/watch?v=HJ0pABDh_gw Thx & Best Rgds, Prakash. I tried this, but the insertion point goes to the 1st character only if I tab into the textbox ... not if i click in the textbox. Here's my code ... Private Sub txt_RcdFm_PdTo_GotFocus() If Nz(Len(Me.txt_RcdFm_PdTo)) = 0 Then MsgBox "Setting Cursor to 1st char" Me.txt_RcdFm_PdTo.SelStart = 0 End If End Sub Will i have to put this same code in another event too ? Why doesn't it work here ? The gotfocus event seems the most logical compared to a MouseClick or MouseDown event, because in any case I'd have to even check to see if the user has tabbed into the field. That means checking in 2 events ? Any ideas or workarounds please ? Best Rgds, Prakash. |
![]() |
| Thread Tools | |
| Display Modes | |
| |