Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Default area code in phone
Ian Joseph 
   
2 years ago
I am using this input mask in a phone number field:   \(999") "000\-0000;;_
The field could only take 10 digits.
I would like to have a default area code on focus or on click using vba.
I tried several methods with no success.
Does anyone know how this could be accomplished.
Kevin Robertson  @Reply  
          
2 years ago
Try this in the On Got Focus event for your phone number.

Phone.InputMask = "(555)" & "000-0000"
Phone.SelStart = 5


Replace 555 with your default area code.
Note: SelStart is needed if you tab to the field (you don't see the input mask unless you press a key on the keyboard. Give this a try.)
Kevin Robertson  @Reply  
          
2 years ago
You're welcome.
Ian Joseph OP  @Reply  
   
2 years ago
Hey Kevin..  thank you for your reply .. it works when the field gets focus .. however it does not save the area code to the table only the seven digits.. so even if it shows the full phone number .. when I close and reopen the record it only displays the 7 digits.. if I click into the field again it shows the area code
Ian Joseph OP  @Reply  
   
2 years ago
this works..
In the input mask property of the field use : \(999") "000\-0000;;_

In the GotFocus use this code:

If IsNull(Me.yourPhoneField) Then
        yourPhoneField.Value = "(555)"
        yourPhoneField.SelStart = 5
End If
    yourPhoneField.InputMask = "(000)000-0000"


This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:20:54 PM. PLT: 1s