Input Mask

L

Luis

Hello.
I'd like to limit a text box to only allow the user to input 9 digits. I've
tryed with an Input Mask (000000000), but when the textbox gets the focus an
underliying line appears and the cursor stays in the end of the line.

How can i force the cursor to go to the begining of the line so that the
users can immediatelly start input data?

Thanks,

Luis.
 
P

Paolo

Hi Luis,

to avoid the underscore line you can specify in your input mask to use
spaces as placeholders in this way

input mask=000000000;;" "

In my knowledge if you enter the field by tabbing you'll have the cursor at
the right position to immediatly write but if you click in the field with the
mouse the cursor will be in the click position and you'll have to press the
home key to go to the beginning of the field.

HTH Paolo
 
J

JimBurke via AccessMonster.com

Here's what I do to put the cursor at the beginning. Create a form module-
level variable, we'll call it fieldFirstClick, make it boolean. In the
textbox's GotFocus event put fieldFirstClick = True. In the textbox's
OnClick event, put

If fieldFirstClick Then
fieldName.SelStart = 1
fieldFirstClick = False
End If

Where 'fieldName' is the name of the textbox. You can also put code in the
GotFocus event to see if the textbox already has a value, and if it does you
can set fieldFirstClick = False, since you may not want to position at the
beginning if it already has a value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

input mask or format to put 2009-XXXXX 5
Time format hh:nn drops leading zero 0
Input mask & auto-tab 1
Input Mask 0
Input mask for Military Time 4
Input Mask Help 1
input mask 4
date+time input mask 3

Top