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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to change a negative number to zero in a query

Status
Not open for further replies.

longbillduck

Technical User
Sep 26, 2001
29
US
I need run a query where a negative number changes to zero, but any positive numbers are also shown.

Art

 
You need to use an expression...

such as:

In design mode of your query, in the "field:" row select the next empty column (of the fields to be returned or viewed in your query)...

add....and replace the generic table and field names to yours.

MyExpression: IIf([tblName]![fieldName]<0,0,[tblName]![fieldName])

be sure to use the dbl II in the IIf statement
 
I did everything as suggested, but I'm not sure what was meant by &quot;the dbl II in the IIf statement&quot;
 
He means the double &quot;I&quot; in the &quot;IIF&quot; statement. A lot of times we forget and only use &quot;IF&quot;.

Jenny
 
One more update:

I tried it once on a &quot;test&quot; database query and got it to work

When I tried to set it up on the query I wanted to use it on, I couldn't get it to work as suggested

I deleted both references of [tblName]! and it worked

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top