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

  • Thread starter Thread starter Tyler at Creme
  • Start date Start date
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?
 
Not tested, but try this
Freight: Format(iif([Item#]<>"RS1000",[Price]*0.04,0),"Currency")
 
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?
 
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?
 
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
 
Back
Top