default area code

  • Thread starter Christopher Glaeser
  • Start date
C

Christopher Glaeser

Apologies for asking as this has no doubt been asked many times, but I can't
find the answer to this specific question. What is a simple solution for a
default area code. That is, where the user may or may not enter the area
code with phone number, and if the area code is not entered, then it is set
to the default area code; otherwise, it is set to the area code specific by
the user.

Best,
Christopher
 
M

Mike Painter

Christopher said:
Apologies for asking as this has no doubt been asked many times, but
I can't find the answer to this specific question. What is a simple
solution for a default area code. That is, where the user may or may
not enter the area code with phone number, and if the area code is
not entered, then it is set to the default area code; otherwise, it
is set to the area code specific by the user.

Best,
Christopher

I'd probably keep it in a separate field but you could use an after update
event to add it.

If len(Me!YourNumber) = 7 then
Me!(yourNumber) = "XXX" & Me!Yournumber
End If

I'm assuming the number is formatted @@@ @@@-@@@@

The other question is why do you need to add a default?
Usually the default is your area code and you would not need it.
 
C

Christopher Glaeser

I'd probably keep it in a separate field but you could use an after update
event to add it.

If len(Me!YourNumber) = 7 then
Me!(yourNumber) = "XXX" & Me!Yournumber
End If
Thanks!

I'm assuming the number is formatted @@@ @@@-@@@@

The other question is why do you need to add a default?
Usually the default is your area code and you would not need it.

I wanted to add the default becuase I used the format (@@@) @@@-@@@@ with
parens, which displays a blank area code as ( ) xxx-xxxx. If I delete the
parens from the format, then you're right, I don't really need the default.
Thanks again.

Best,
Christopher
 
C

Christopher Glaeser

Me!(YourNumber) = "XXX" & Me!YourNumber

Is this syntax correct? I get an error when executed?

Best,
Christopher
 
C

Christopher Glaeser

Got it! Syntax is ...

Me!YourNumber = "XXX" & Me!YourNumber

Best,
Christopher
 
M

Mike Painter

Christopher said:
Is this syntax correct? I get an error when executed?

Sorry about that. [ ] would have worked but is not needed unless there is a
space in the field name. I don't know why I used ()

Usually I blame that kind of an error on my dog.
 
Top