![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||||
| |||||
|
|
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 ? |
|
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 ? I entered in the OnEnter, OnGetFocus, and OnMouseDown a message box. |
|
Any ideas or workarounds please ? Use DOS. |
|
Best Rgds, Prakash. |
#12
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |