How do I parse a phone number?

  • Thread starter Thread starter gagecres
  • Start date Start date
G

gagecres

I have a report where I use a text box to enter a phone number that the user
has entered on the main form. Currently, I have my verbiage with the phone
number text box right next to it. For example, "I can be reached at:" [Phone
Number]. When I do this the phone number is in the format I would expect,
(123)456-7890. I made a change to the line so that the entire line is in the
same text box. For example, ="discuss this further, I can be reached at: " &
[Investor Phone] & "." When I do this the phone number appears like so,
1234567890. Is there a way I can enter this line into the text box so that
the phone number has the parenthesis and dash , i.e. (123)456-7890?
 
If you always have all ten digits, something like this might work:

="discuss this further, I can be reached at: " & Format$([Investor
Phone],"(###)###-####")

Pete
 
I keep getting a syntax error.

Petr Danes said:
If you always have all ten digits, something like this might work:

="discuss this further, I can be reached at: " & Format$([Investor
Phone],"(###)###-####")

Pete


gagecres said:
I have a report where I use a text box to enter a phone number that the
user
has entered on the main form. Currently, I have my verbiage with the
phone
number text box right next to it. For example, "I can be reached at:"
[Phone
Number]. When I do this the phone number is in the format I would expect,
(123)456-7890. I made a change to the line so that the entire line is in
the
same text box. For example, ="discuss this further, I can be reached at:
" &
[Investor Phone] & "." When I do this the phone number appears like so,
1234567890. Is there a way I can enter this line into the text box so
that
the phone number has the parenthesis and dash , i.e. (123)456-7890?

.
 
I keep getting a syntax error.

Petr Danes said:
If you always have all ten digits, something like this might work:

="discuss this further, I can be reached at: " & Format$([Investor
Phone],"(###)###-####")

Pete

gagecres said:
I have a report where I use a text box to enter a phone number that the
user
has entered on the main form. Currently, I have my verbiage with the
phone
number text box right next to it. For example, "I can be reached at:"
[Phone
Number]. When I do this the phone number is in the format I would expect,
(123)456-7890. I made a change to the line so that the entire line is in
the
same text box. For example, ="discuss this further, I can be reached at:
" &
[Investor Phone] & "." When I do this the phone number appears like so,
1234567890. Is there a way I can enter this line into the text box so
that
the phone number has the parenthesis and dash , i.e. (123)456-7890?

.

Did you check for improper word wrap?
You'll have to post your exact expression by copying it and pasting it
into a reply message..
 
I gave it in the form you would use it in VBA code. If you're using the
expressions in a query, form or report, use it without the dollar sign. Also
try with a semicolon instead of a comma.

Pete


gagecres said:
I keep getting a syntax error.

Petr Danes said:
If you always have all ten digits, something like this might work:

="discuss this further, I can be reached at: " & Format$([Investor
Phone],"(###)###-####")

Pete


"gagecres" <[email protected]> píše v diskusním
příspěvku
I have a report where I use a text box to enter a phone number that the
user
has entered on the main form. Currently, I have my verbiage with the
phone
number text box right next to it. For example, "I can be reached at:"
[Phone
Number]. When I do this the phone number is in the format I would
expect,
(123)456-7890. I made a change to the line so that the entire line is
in
the
same text box. For example, ="discuss this further, I can be reached
at:
" &
[Investor Phone] & "." When I do this the phone number appears like
so,
1234567890. Is there a way I can enter this line into the text box so
that
the phone number has the parenthesis and dash , i.e. (123)456-7890?

.
 
And another 'brute force' method:

="discuss this further, I can be reached at: (" & left([Investor Phone];3) &
")" & mid([Investor Phone];4;3) & "-" & right([Investor Phone];4)

Pete



gagecres said:
I keep getting a syntax error.

Petr Danes said:
If you always have all ten digits, something like this might work:

="discuss this further, I can be reached at: " & Format$([Investor
Phone],"(###)###-####")

Pete


"gagecres" <[email protected]> píše v diskusním
příspěvku
I have a report where I use a text box to enter a phone number that the
user
has entered on the main form. Currently, I have my verbiage with the
phone
number text box right next to it. For example, "I can be reached at:"
[Phone
Number]. When I do this the phone number is in the format I would
expect,
(123)456-7890. I made a change to the line so that the entire line is
in
the
same text box. For example, ="discuss this further, I can be reached
at:
" &
[Investor Phone] & "." When I do this the phone number appears like
so,
1234567890. Is there a way I can enter this line into the text box so
that
the phone number has the parenthesis and dash , i.e. (123)456-7890?

.
 
Back
Top