Expression within a Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

As you can tell I am new to Access.

I have a query with a field called Value. I would like to create an
expression field that would give me the following:

If, Value equals IPS or ECR, then IPS/ECR, otherwise use the Value.

I have tried: IIf [Value]=[IPS]![IPS/ECR].
This of course doesn't work, but I am not sure of the wording for such a
statement. Any help would be greatly appreciated.
 
As you can tell I am new to Access.

I have a query with a field called Value. I would like to create an
expression field that would give me the following:

If, Value equals IPS or ECR, then IPS/ECR, otherwise use the Value.

I have tried: IIf [Value]=[IPS]![IPS/ECR].
This of course doesn't work, but I am not sure of the wording for such a
statement. Any help would be greatly appreciated.

1) Value is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

2) After you change the field name to something else try:
Exp:IIf([AValue] = "IPS" or [AValue] = "ECR","IPS/ECR",[AValue])
 
Thanks much, I will check out the resources you suggested.

Teri

fredg said:
As you can tell I am new to Access.

I have a query with a field called Value. I would like to create an
expression field that would give me the following:

If, Value equals IPS or ECR, then IPS/ECR, otherwise use the Value.

I have tried: IIf [Value]=[IPS]![IPS/ECR].
This of course doesn't work, but I am not sure of the wording for such a
statement. Any help would be greatly appreciated.

1) Value is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

2) After you change the field name to something else try:
Exp:IIf([AValue] = "IPS" or [AValue] = "ECR","IPS/ECR",[AValue])
 
Back
Top