landing cursor to BEGINNING of TextBox's input mask

  • Thread starter John S. Ford, MD
  • 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
 
K

Ken Snell

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!
 
J

John S. Ford, MD

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
 
K

Ken Snell

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.
 
D

Dan Artuso

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.
 
A

AlCamp

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
 
J

John S. Ford, MD

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
 
D

Dan Artuso

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?
 

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

Top