Solved

Setting cursor in phone number field (text box)

Posted on 2014-02-18
3
385 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 36

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

749 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