TELEPHONE MASK

D

Debbie

I enter a mask for a telephone # using "716" for the area code

!"(716) "000\-0000;0;_

Our area code is 716; sometimes, very rarely, I have to use another
area code. With this mask, it does not allow me to change the "716"
What can I do that will use the default but also will let me change the
area code when needed.

Thank you in advance!
 
T

tina

well, i was able to do it by putting the following input mask on the form
control, as

\(000") "000\-0000;0;_

note the absence of the exclamation point at the beginning of the mask.
then i added the following code to the control's Enter event, as

If IsNull(Me!ControlName) Then
Me!ControlName = "716"
Me!ControlName.SelStart = 6
End If

the above adds the default area code, then moves the cursor the the first
position of the phone number prefix. the problem with this solution is that
if you don't complete the phone number, the "mask validation" does not fire,
and the record will be saved with the area code only (which normally the
mask would prohibit). i solved that, more or less, with the following code
on the form's BeforeUpdate event, as

If Len(Me!ControlName) < 10 Then
Me!ControlName = Null
End If

hth
 
D

Debbie

This lets me change the area code, which is mainly what i wanted, but
when I tab in the cell, it leaves (716) -
Is there any code that will eliminate this. I tab to pass the field
when there is no phone number to put in cell.
Any suggestions!
I can live with this if need be.

Thank you!
 
T

tina

no suggestions, other than the form's BeforeUpdate code that deletes an
incomplete phone number, as i previously posted.

hth
 
J

John Vinson

This lets me change the area code, which is mainly what i wanted, but
when I tab in the cell, it leaves (716) -
Is there any code that will eliminate this. I tab to pass the field
when there is no phone number to put in cell.
Any suggestions!

Well... what you're asking would seem to be IMPOSSIBLE.

You're asking Access to decide when you tab into a cell whether you
are doing so with the *intention* of entering a value, or with the
*intention* of tabbing on through.

You're dealing with a computer, not a psychic! <g>

John W. Vinson[MVP]
 
J

John Welch

What about using the before update event to add 716 to the beginning of the
value in the box if the value is exactly 7 digits long?
That way, you can just leave off the area code for 716, and type it in for
all others.
Not sure if the input mask will give you problems. Sorry, i'm not going to
test this idea or give code right now.
-John
 
J

John Nurick

Or first set "716" as the default value, and then test it in the form's
BeforeUpdate event. If it's still 716, no number has been entered, so
set it to Null; any other value, leave it alone so it gets stored.
 
T

Tim Ferguson

You're asking Access to decide when you tab into a cell whether you
are doing so with the *intention* of entering a value, or with the
*intention* of tabbing on through.

Microsoft Windows Telepathy Edition, due for release in... Microsoft ain't
saying, they figure we'll "know" when it's ready!

All the best


Tim F
 
T

tina

LOL!


Tim Ferguson said:
Microsoft Windows Telepathy Edition, due for release in... Microsoft ain't
saying, they figure we'll "know" when it's ready!

All the best


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top