Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expressions in Queries 1

Status
Not open for further replies.

windmag

Technical User
Aug 8, 2001
2
US
I am trying to create an expression that will allow me to create a new value based on another field (TAXABLE)in my query.

1. add sales tax to a certain field (Expr3)if the TAXABLE field in my query is yes, or
2. return a null or zero value if the TAXABLE field is no.

I've tried the following expression, however I get an ERROR value in the field.

Any help would be appreciated.

Expr4: IIf([TAXABLE?]="YES",[Expr3]*0.065," ")
 
Assuming you've formatted taxable? as a yes/no field. Don't put quotes around YES.

In VB YES or TRUE = -1, NO or FALSE = 0. By putting quotes around "YES" you are creating a string. The query is looking for the literal value "YES" in a field that actually contains -1 or 0

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top