Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    input mask problems (2002)

    My phone number field on a form has an input mask on it. Therefore, when I click into the field (instead of tabbing into it), the cursor stays where I click instead of going to the beginning of the field. This is a problem for those who are using the form for data entry. Is there any simple way of changing this? Right now, I'm using the SendKeys statement in the Click event to "type in" the HOME key for the user.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: input mask problems (2002)

    This is inherent in using an input mask. It's one of the reasons why I don't use input masks (except for passwords). Your workaround has the disadvantage that the user can't click in the phone number to edit a specific digit.

    An alternative for your SendKeys (with the same disadvantages) would be

    Private Sub txtPhone_Click()
    With Me.txtPhone
    .SelStart = 0
    .SelLength = 0
    End With
    End Sub

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: input mask problems (2002)

    Let me add another issue with using masks for phone numbers - if the number is an international number (i.e. doesn't conform to the North American dialing plan) which means about 80% of the world, then it's almost impossible to construct an input mask that is usable. We actually created a set of validation code to determine what kind of number was being entered, and challenge the user if it didn't conform to the rules we established - for example, North American numbers had to have 3 digits, a dash, 3 digits, a dash and 4 digits. Extensions could be added, but had to be prefixed with one space and an X. This may not apply in your case, but it is a consideration for many developers.
    Wendell

  4. #4
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: input mask problems (2002)

    Thanks, Hans, Wendell. The international phone number problem isn't really relevant for my purposes, so I guess I'll just stick to my workaround (despite its disadvantages). However, it's good to know that I didn't miss any obvious Access trick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •