landing cursor to BEGINNING of TextBox's input mask

  • Thread starter Thread starter John S. Ford, MD
  • Start date Start date
J

John S. Ford, MD

I'm using Access 97. I have a form that has some TextBoxes that use various
input masks (for dates, etc.). If the user tabs from one field to the next,
the whole input mask is selected and the user can simply begin entering
data.

If the user mouseclicks into the TextBox, unless he clicks right at the left
edge the cursor won't start at the beginning of the input mask and data
entry becomes very confusing. is that a way to ensure that on entering the
TextBox, the cursor will ALWAYS land at the beginning of the input mask (ie.
all the way to the left)?

John
 
Ken Snell said:
Or one might use the OnGotFocus event to set the SelStart property to 1.

and then again....no. The above won't work.... shoulda tested before
suggesta!
 
LOL. It's OK Ken. I did! I don't know how other programs do this. I was
just playing around with QuickBooks which requires a valid social security
number format (###-##-####) for SS# fields and IT seems to behave the way I
want my program to behave. No matter how I get into an SS# field even with
a mouse click, the cursor goes to the far left. Hmmmmm?

John
 
Quickbooks must have coded that behavior into it. Arvin's answer likely is
your solution -- I've not worked with keystroke macros, so I can't offer
additional advice towards that solution, though.
 
Hi,
Well, if you put this in the click event:
Me.Text0.SelStart = 0

The cursor will always go to the left. Of course this might interfere with some 'normal' behavior.
 
I used both the OnEnter and Click event with... MyField.SelStart = 0, and
that seemed to work just like you requested. The cursor jumps to the left
Am I missing something about your problem?
Al Camp
 
I tried using the OnEnter and OnClick TextBox.SelStart = 0 trick but it
didn't work if there was an input mask in the field. What am I doing wrong?

John
 
Hi,
Not sure. It works for me even with an input mask.
Do you have any other code that executes besides the
TextBox.SelStart = 0
line?
 
Back
Top