How to set cursor position in input masked date field

kjohns

Registered User.
Local time
Today, 15:00
Joined
Feb 22, 2008
Messages
26
Is there a way (macro, maybe) to set the cursor position of a date field (that uses an input mask) when my users click on it?

When a user tabs through the fields, she is automatically placed in the first position of the __/__/____ field. However, when a user clicks in the date text box, she is placed where ever she clicked (which is usually not on the far left side of the field).

Any suggestions (other than telling all users to use their Tab buttons instead of their mice) would be appreciated. Thanks!
 
if you can use vba the SelStart (select start) method will do it.
 
Thanks, Wazz. Is this something you could walk me through? Very limited VBA skills here.
 
Resolved

Wazz, thanks again for the SelStart property.

I placed the following code in the OnClick property of my date fields:

Private Sub EvaluationDate_Click()
Me!EvaluationDate.SelStart = 0
End Sub
 
that's it. i usually test for null first figuring that if there is something there then the user might have clicked in a specific place.
Code:
If IsNull(Me.ActiveControl) Then
    Me.ActiveControl.SelStart = 0
End If
haven't checked for a while but this might still work: http://support.microsoft.com/?kbid=268102
 
that's it. i usually test for null first figuring that if there is something there then the user might have clicked in a specific place.
This would make sense in a field without an Input Mask, but if the field has one, as stated by the OP, this is unnecessary. Access won't let you leave a field with an Input Mask until the mask is satisfied, so you can't leave it half done and then click back in to complete it.
 
hey linq, i lost track of this thread. just to clarify, i don't mean to test for null while entering data or clicking in and out of the field, i mean that if something is there (a completed field), then perhaps the user will click directly on a specific character in order to change it and this will prevent having them sent to the beginning of the field.
 

Users who are viewing this thread

Back
Top Bottom