IF statement in a query....

T

tom

I am fairly new to using Access and I need some assistance in working with an
expression....

Working with Access 2007 I have a table that has a column (Name) with
several clients names in it and I would like to write an expression that
isolates Bank of America and labels all other clients as "Misc".

Example:
Current Return Desired

Name (Column Name) Name (Column Name)
BofA BofA
BofA BofA
BofA BofA
24 HR Fit Misc
Subway Misc
Subway Misc
Albertsons Misc
Wendy's Misc
Sharky's Misc

Thank you for your help!
 
X

XPS350

I am fairly new to using Access and I need some assistance in working with an
expression....

Working with Access 2007 I have a table that has a column (Name) with
several clients names in it and I would like to write an expression that
isolates Bank of America and labels all other clients as "Misc".

Example:
Current                                      Return Desired

Name (Column Name)                 Name (Column Name)
BofA                                           BofA
BofA                                           BofA
BofA                                           BofA
24 HR Fit                                    Misc  
Subway                                       Misc  
Subway                                       Misc
Albertsons                                   Misc
Wendy's                                      Misc
Sharky's                                      Misc

Thank you for your help!

You use the IIF function in a query rather than the IF statement.

In your case it could look like: IIF(Name="BofA";"BofA";"Misc")

Groeten,

Peter
http://access.xps350.com
 
L

Leo

Peter,
In the Iff statement each argument is separated by a ";". Is that right or
should it be ","?

Thanks
Leo
 
S

Sylvain Lafontaine

The value of the list separator - either the comma , or the semi-coma ; -
used by Access depends on the Regional setting of your computer.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)
 
J

John W. Vinson

Peter,
In the Iff statement each argument is separated by a ";". Is that right or
should it be ","?

Depends on where you are: some countries use one, some use the other. In the
US use a comma; in Germany use a semicolon; I'm not sure even how to find out
which countries use which.
 

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

Top