How do I write a calculated field to apply only to certain records

T

Tyler at Creme

I am trying to create a simple calculated field in a query it is: Freight:
[Price]*0.04.
But I only want it to apply to all records without "RS1000" in an [Item#]
field. For those, I want the amount to be $0. And I want it Formatted for
Currency.
What is the syntax for this?
 
R

RonaldoOneNil

Not tested, but try this
Freight: Format(iif([Item#]<>"RS1000",[Price]*0.04,0),"Currency")
 
T

Tyler at Creme

Result popped up a parameter box for Item #
--
Tyler at Creme
New Access User


RonaldoOneNil said:
Not tested, but try this
Freight: Format(iif([Item#]<>"RS1000",[Price]*0.04,0),"Currency")

Tyler at Creme said:
I am trying to create a simple calculated field in a query it is: Freight:
[Price]*0.04.
But I only want it to apply to all records without "RS1000" in an [Item#]
field. For those, I want the amount to be $0. And I want it Formatted for
Currency.
What is the syntax for this?
 
J

John W. Vinson

Result popped up a parameter box for Item #

That suggests that there is no control named Item# on your form. Using # in
names is not a good idea in any case, as it is a date delimiter. What is the
actual control name on your form containing the RS1000 value? What is the
actual IIF statement that you used?
 
T

Tyler at Creme

Okay, I reimported on using ItemNum instead of Item#, I used Freight:
Format(iif([ItemNum]<>"RS1000",[Price]*0.04,0),"Currency") and it worked, so
thanks John and Ronaldo
 

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