How to format a number/string

R

RC-

I have a phone number that is currently formatted this way:

(555) 123-4567

I want to force the format to be:

555/123-4567

I'm using VBA to get the data and the original formatting is coming over
with it. Is there a way to "reset" the format so it just picks up the
numbers?

Any help is great
RC-
 
F

fredg

I have a phone number that is currently formatted this way:

(555) 123-4567

I want to force the format to be:

555/123-4567

I'm using VBA to get the data and the original formatting is coming over
with it. Is there a way to "reset" the format so it just picks up the
numbers?

Any help is great
RC-

It depends upon how the actual data is stored, not how it's displayed.
If the data is actually saved as 5551234567 then set the control's
Format property to:
@@@\/@@@-@@@@

However if the data is actually stored as (555) 123-4567, then: as an
unbound control's control source:

=Mid([Phone],2,3) & "/" & Mid([Phone],7,3) & "-" & Right([Phone],4)
 
R

RC-

Thank you very much, that's what I needed!

RC-
fredg said:
I have a phone number that is currently formatted this way:

(555) 123-4567

I want to force the format to be:

555/123-4567

I'm using VBA to get the data and the original formatting is coming over
with it. Is there a way to "reset" the format so it just picks up the
numbers?

Any help is great
RC-

It depends upon how the actual data is stored, not how it's displayed.
If the data is actually saved as 5551234567 then set the control's
Format property to:
@@@\/@@@-@@@@

However if the data is actually stored as (555) 123-4567, then: as an
unbound control's control source:

=Mid([Phone],2,3) & "/" & Mid([Phone],7,3) & "-" & Right([Phone],4)
 

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

Similar Threads


Top