Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Phone number entry

2 views
Skip to first unread message

Will Pittenger

unread,
Sep 13, 2004, 10:59:58 PM9/13/04
to
I expect to copy and paste (and sometimes drag and drop) phone numbers into
a phone number formatted field. Is it possible to have the Input format
adjust to the source format and translate the phone number into the field's
mask? I normally use ###-###-####. However, some phone numbers are
formatted (###) ###-####, ###.###.####, ### ### ####, or some combination of
those formats. As is, I have to copy the phone number over piece by piece
until I have the entire number. I would prefer to copy the number with one
pass.

Also, when dragging and dropping phone numbers, I would like the area code
defaulted, in my case to 503. That way, if the text value is just 345-3434,
the field gets set to 503-345-3434.
----------
Will Pittenger
E-Mail: mailto:will.pi...@verizon.net
All mail filtered by Qurb (www.qurb.com)


Mike Painter

unread,
Sep 14, 2004, 12:04:16 AM9/14/04
to
Will Pittenger wrote:
> I expect to copy and paste (and sometimes drag and drop) phone
> numbers into a phone number formatted field. Is it possible to have
> the Input format adjust to the source format and translate the phone
> number into the field's mask? I normally use ###-###-####. However,
> some phone numbers are formatted (###) ###-####, ###.###.####, ###
> ### ####, or some combination of those formats. As is, I have to
> copy the phone number over piece by piece until I have the entire
> number. I would prefer to copy the number with one pass.
>
> Also, when dragging and dropping phone numbers, I would like the area
> code defaulted, in my case to 503. That way, if the text value is
> just 345-3434, the field gets set to 503-345-3434.

Drag and drop is not supported in Access.

A field mask is different from a field format and I suspect you are
interested in the latter.

It is usually better to use a text field and @@@ @@@-@@@@. This is
especially true if you are pasting non numeric characters.
that way 3451234 formats as 345-1234 and the leading "-" does not show.

If you paste a value in that contains any characters you do not want, you
will have to write code to strip those characters. The Replace function
would be ideal for this.
You could then check to see if the string was 7 characters long and add 503
to it if needed.


Will Pittenger

unread,
Sep 14, 2004, 12:26:27 AM9/14/04
to
Sorry, wrong placeholder. Try 000\-000\-0000.

I can drag text that I select in IE to my field in Access. It acts like I
typed it my self.

How do I put that code into Access?


----------
Will Pittenger
E-Mail: mailto:will.pi...@verizon.net
All mail filtered by Qurb (www.qurb.com)

"Mike Painter" <mddotp...@sbcglobal.net> wrote in message
news:45u1d.19352$Lk3....@newssvr27.news.prodigy.com...

Mike Painter

unread,
Sep 14, 2004, 2:03:12 AM9/14/04
to
Will Pittenger wrote:
> Sorry, wrong placeholder. Try 000\-000\-0000.
>
> I can drag text that I select in IE to my field in Access. It acts
> like I typed it my self.
>
> How do I put that code into Access?

The replace function is described in help. It would appear in probably the
on exit event.

Will Pittenger

unread,
Sep 15, 2004, 1:01:30 PM9/15/04
to
I was just looking at it. Access is asking whether I want to use the
"Expression Builder", "Macro Builder", or the "Code Builder". I used the
expression builder for other things. Still, for this type of thing, would
the others be better? Also, can Replace strip out multiple characters at
once? MFC's CString (and probably .NET if I were to check) allow find and
replace of strings like "() ." with "-". In this case, I think I need two
calls to Replace as the parentheses would not be replaced with dashes.
Either that or I would remove all such characters entirely and let the input
mask format the string.

----------
Will Pittenger
E-Mail: mailto:will.pi...@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Mike Painter" <mddotp...@sbcglobal.net> wrote in message
news:AQv1d.19383$Ax4....@newssvr27.news.prodigy.com...

Mike Painter

unread,
Sep 15, 2004, 5:46:01 PM9/15/04
to
Will Pittenger wrote:
> I was just looking at it. Access is asking whether I want to use the
> "Expression Builder", "Macro Builder", or the "Code Builder". I used
> the expression builder for other things. Still, for this type of
> thing, would the others be better? Also, can Replace strip out
> multiple characters at once? MFC's CString (and probably .NET if I
> were to check) allow find and replace of strings like "() ." with
> "-". In this case, I think I need two calls to Replace as the
> parentheses would not be replaced with dashes. Either that or I would
> remove all such characters entirely and let the input mask format the
> string. ----------

Clearly this is not a macro and the expression builder is used to build
expressions.
You should have the option of "event procedure" and that is what this is.

I don't know how Replace handles the replacement you give as an example.
Try it and find out.

I suspect it will do as your example but you need each item in a string such
as "().-" replaced item by item. It would be easy to build a function that
did this but Pick Basic is the only Basic I know that has it.


John Vinson

unread,
Sep 15, 2004, 6:54:39 PM9/15/04
to
On Wed, 15 Sep 2004 10:01:30 -0700, "Will Pittenger"
<will.pi...@verizon.net> wrote:

>Either that or I would remove all such characters entirely and let the input
>mask format the string.

That's what I would suggest. You can use three or four Update queries,
one for each character - update Phone to

Replace([Phone], "(", "")

and similarly for the other punctuation, including blank.

John W. Vinson[MVP]
(no longer chatting for now)

Will Pittenger

unread,
Sep 15, 2004, 8:32:56 PM9/15/04
to
I think that I would still prefer something like shown below. It would use
the second string as a set, not a substring.

RemoveCharFromString([field], "(). ")


----------
Will Pittenger
E-Mail: mailto:will.pi...@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Mike Painter" <mddotp...@sbcglobal.net> wrote in message

news:tK22d.15992$QJ3....@newssvr21.news.prodigy.com...

Mike Painter

unread,
Sep 16, 2004, 12:11:08 AM9/16/04
to
Will Pittenger wrote:
> I think that I would still prefer something like shown below. It
> would use the second string as a set, not a substring.
>
> RemoveCharFromString([field], "(). ")
>
Then you will have to switch to Pick Basic and use Convert, write it
yourself or get somebody to do it for you.

PickConvert( String, "abc", "12")

If string is "a bad boy calls" the result should be "1 21d 2oy 1lls"

a matches and is replaced by 1.
b matches and is replaced by 2.
c has no match so is removed.

Replace makes it easy to do.


0 new messages