Date field - go to first character

G

Guest

I am using Windows XP and Access 2000. I have a form which has a date field
with an input mask 00/00/0000;0;_

When this field is clicked or tabbed into, I need the cursor to always go to
the first character.

Can this be done?

Many thanks in advance.
 
G

Guest

Richard:

You can put the following in the control's GotFocus event procedure:

Dim ctrl As Control

Set ctrl = Me.ActiveControl
ctrl.SelLength = 0
ctrl.SelStart = 0

It will work fine if you navigate to the control with the keyboard, but if
you click into the control with the mouse the insertion point will be
wherever in the control you click, not at the start. You could overcome this
by repeating the code in the control's MouseUp event procedure to force the
insertion point back to the start after clicking. However, this would have
the drawback that you could not click into the middle of an existing value in
the control if, for instance, you want to edit it; you'd have to use the
keyboard to move the insertion point from the start position.

Ken Sheridan
Stafford, England
 

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

Date conversion 8
Date 6
Input Mask for Date and Time 2
Date Field 7
Date format with input masks 2
How to validate a date entered on a form 2
Filter on date problem 8
Input Mask (or is there a better way) 1

Top