Checkbox Altering Input Mask

kyle1234567

Registered User.
Local time
Today, 10:20
Joined
Aug 27, 2012
Messages
10
Hello, everyone:

I have a form containing a standard text box into which domestic phone numbers are entered by the end-user. Since 99% of this project involves clients in the country, the numbers will almost always be in the same format.

However, there needs to be the option to enter an international phone number, in case a client lives elsewhere. This phone number will most likely have a different format, so the input mask will become a barrier to data entry.

I would like to put a simple checkbox next to the text box labeled, "Int'l?" The user could click this to remove the input mask and allow them to simply enter the number as a text string. What is the best way to code this process? Should the code be inserted into the checkbox properties, or the textbox's? Forgive my ignorance! I'm relatively new with Access, but learning fast.

Thanks very much,

Kyle
 
What stops the user from clicking the Int'l checkbox and entering local numbers?

Welcome to the forum! :)
 
Using ac2003 i use the Before update event of the tick box to remove the input mask of a record . The input mask for the phone number is in the field of the table in my case not the form .

Private Sub Check9_BeforeUpdate(Cancel As Integer)
If Me.Check9 = -1 Then
Me.date.InputMask = ""
Else
Me.date.InputMask = " \(9999) 00090009;;"
End If
End Sub
Hope this is some help to you

Sub my Me.date to your me.Int'l
 
Last edited:
Using ac2003 i use the Before update event of the tick box to remove the input mask of a record . The input mask for the phone number is in the field of the table in my case not the form .

Private Sub Check9_BeforeUpdate(Cancel As Integer)
If Me.Check9 = -1 Then
Me.date.InputMask = ""
Else
Me.date.InputMask = " \(9999) 00090009;;"
End If
End Sub
Hope this is some help to you

Sub my Me.date to your me.Int'l
Yes it's easy enough to write code to get it removed, but that doesn't really solve the problem. The question still stands, "what stops the user from entering a local date after the Int'l checkbox is ticked?"

The best possible advice is to create an Input Mask that will attempt to cover both possibilities.
 
Yes it's easy enough to write code to get it removed, but that doesn't really solve the problem. The question still stands, "what stops the user from entering a local date after the Int'l checkbox is ticked?"

Hardly constructive criticism. My mistake I thought this was a forum were all members could have some input, what ever their level of skill without personal attacks. By the way it was a telephone number not a date.
 
Don't take it as criticism, it's a prompt for the OP to re-think his idea. In my experience, if a question is asked and suddenly someone offers a solution that doesn't answer the question the OP is left to think that the solution will suffice in all cases, hence, my prompt.

I was only quoting you so don't take it personal ;)

And yes you're right, I meant telephone number not date.
 
.
VbaInet . OK fair comment but, surely a
Possible example of how you would have solved the problem would have benefited all of us who are not programmers .
 
I can't give a solution just yet. If we're dealing with both International and Local numbers, we would need to know the format of both.
 
Hello, everyone!

Thank you for the "lively" discussion. :)

First, nothing stops the user from clicking the "international" checkbox and then entering a local number. This is a relatively small database (only 300 records, but thousands of metadata points about each one); if this happened, it would be pretty easy to see and fix. If there is an easy way to make sure this doesn't happen, great. If not, I'm not too worried about it.

Second, it would be difficult to create an input mask for the international number, simply because they vary from country to country. Although country codes are pretty standard, what comes next can be quite different (i.e., area codes with differing number of digits, etc.) I'm thinking just a regular text field where the number can be entered in whatever format seems easiest for the database operator.
 
If you're happy with turning off/on the Input Mask property then ypma has kindly given you a solution there.

Otherwise, I would create two textboxes, one for Local and the other for International. Bind both controls to the same fiield and Enable the Iternational control only when the checkbox is checked, in which case you would also disable the Local textbox.

This is just from a design/usability perspective.
 
Thanks for your help, everyone! Very much appreciate this advice.
 

Users who are viewing this thread

Back
Top Bottom