A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formatting phone field based on value in another field



 
 
Thread Tools Display Modes
  #1  
Old April 15th, 2010, 11:25 PM posted to microsoft.public.access.forms
Ken Warthen[_2_]
external usenet poster
 
Posts: 39
Default Formatting phone field based on value in another field

I'm trying to format a field that contains a phone number on a split form.
If the value in the Country/Region field is equal to the value "USA" I want
the phone field to format as (@@@) @@@-@@@@. If the value is equal to any
other country abbreviation I want to display whatever the value is without
formatting. I'm using the following in the Control Source for the phone
number field, but it's generating #Name? values.

=IIf([Country/Region]="USA",Format([Business Phone],"(@@@)
@@@-@@@@"),[Business Phone])

Any idea what I'm doing wrong here?

Ken
  #2  
Old April 16th, 2010, 05:33 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Formatting phone field based on value in another field

On Thu, 15 Apr 2010 15:25:01 -0700, Ken Warthen
wrote:

The error seems to indicate that either [Country/Region] or [Business
Phone] is not the name of a field in the underlying data set.
Otherwise your expression looks good.

-Tom.
Microsoft Access MVP


I'm trying to format a field that contains a phone number on a split form.
If the value in the Country/Region field is equal to the value "USA" I want
the phone field to format as (@@@) @@@-@@@@. If the value is equal to any
other country abbreviation I want to display whatever the value is without
formatting. I'm using the following in the Control Source for the phone
number field, but it's generating #Name? values.

=IIf([Country/Region]="USA",Format([Business Phone],"(@@@)
@@@-@@@@"),[Business Phone])

Any idea what I'm doing wrong here?

Ken

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.