?
Solved

Setting cursor in phone number field (text box)

Posted on 2014-02-18
3
Medium Priority
?
402 Views
Last Modified: 2014-03-02
I have an Access 2007 form, which contains a text box represented in a phone number format, e.g.

!\(999")"000\-0000

If the field is empty, I would like the cursor to be placed at the beginning of the field.
If the field contains a phone number, I would like the cursor to remain where the user clicked the field.

How would I go about doing this?

Thanks...Tom
0
Comment
Question by:tpigielski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 38

Expert Comment

by:PatHartman
ID: 39867916
I'm not sure you can control that.  The input mask gets in the way of normal data entry.  You can try changing the "Behavior on entering field" property in  file/options/client settings but I'm not sure that would help.  I like it to select all when the user tabs into a field.  The problem is that this setting is universal so changing it changes it for EVERY database.
0
 

Accepted Solution

by:
tpigielski earned 0 total points
ID: 39886837
This in fact can be controllable.  Here is the code that I used to do this:

Private Sub txtPrimaryPhone_Click()

  If txtPrimaryPhone.Tag = True Then
    txtPrimaryPhone.Tag = False
    txtPrimaryPhone.SelStart = 0
    txtPrimaryPhone.SelLength = 0
  End If
 
End Sub

Private Sub txtPrimaryPhone_GotFocus()

    txtPrimaryPhone.Tag = True
    txtPrimaryPhone.SelStart = 0
    txtPrimaryPhone.SelLength = 0
   
End Sub

Private Sub txtPrimaryPhone_KeyUp(KeyCode As Integer, Shift As Integer)

    txtPrimaryPhone.Tag = False
   
End Sub
0
 

Author Closing Comment

by:tpigielski
ID: 39898363
Other answer did not solve my problem.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question