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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Input Mask for Phone Number
Jon Nelson 
     
14 months ago
I am setting up a phone input form for my organization which will work with a touch screen so they can press the numbers and it inputs it into a text box. I've set it just like Richard's calculator video. The On-Click event for each button reads =AddToPhone([ActiveControl].[Caption]). When a number is pressed, the AddToPhone function adds the number to the PhoneText string and displays it in the forms text box. Unfortunately, this does not allow for an input mask. It keeps adding the numbers from right to left no matter how the text box is justified. Ideally, I would want it to add the "-" in the correct spot as it is inputted just as it does on an iphone. Any help is most appreciated.
John Davy  @Reply  
         
14 months ago
See attached clip   John
John Davy  @Reply  
         
14 months ago

John Davy  @Reply  
         
14 months ago
Hi Jon take a look at Richard's video on Formatting  https://599cd.com/blog/display-article.asp?ID=2093
Jon Nelson OP  @Reply  
     
14 months ago
Thank you John. I had watched this and had put an input mask on the unbound text box. The problem seems to be that the text box is not being inputted with a keyboard directly into the textbox but by a push of a button to a variable string in the vba code which and then the string is sent to the text box. For example, pressing the 7 button adds 7 to the string and then sends it to the text box. Here is the code:
Private Function AddToPhone(S As String)

    PhoneText = PhoneText & S

End Function
I am going to try to actually input the "-" separately by adding it to the VBA code based on the position of the added number and see if that works.

John Davy  @Reply  
         
14 months ago
Notice that the input mask in my example is on the table.
Bill Carver  @Reply  
      
14 months ago
in the button you can use concatenation to make the format
Kevin Robertson  @Reply  
          
14 months ago
Is this what you are looking to do?

Private Function AddToPhone(S As String)

    If Len(PhoneText) = 12 Then Exit Function

    If Len(PhoneText) = 3 Or Len(PhoneText) = 7 Then
        PhoneText = PhoneText & "-"
    End If
    PhoneText = PhoneText & S
    
End Function

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access 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/7/2026 12:53:14 AM. PLT: 0s