Writing Expressions in Access

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

Guest

This is a simple expression, I just am having issues today. I am trying to
write an expression that show the difference between 2 fields and if the
second field is 0 then no total would display.
 
iif(nz(Field2) = 0, null, abs(field1 - field2))



Chris Nebinger
 
iif(nz(Field2) = 0, null, abs(field1 - field2))



Chris Nebinger
 
OK so this is what I have
= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value)

I get a Syntax Error
 
iif Reviewed value is "0" then Cut Value is "0" otherwise Original Cost -
REviewed Value in Cut Value

That is what I trying to write. I can do the subraction expression fine,
but I am having a block when it comes the the rest.
 
Watch those parentheses and square brackets. They must match up. I think
what you need is:

IIF([Reviewed Value] = 0, null, [Complete Date] - [Reviewed Value])


Casey P said:
OK so this is what I have
= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value)

I get a Syntax Error

iif(nz(Field2) = 0, null, abs(field1 - field2))



Chris Nebinger
 
Huh, I knew it was something simple. I was leaving the "null" out!

Thanks sir.

John Spencer said:
Watch those parentheses and square brackets. They must match up. I think
what you need is:

IIF([Reviewed Value] = 0, null, [Complete Date] - [Reviewed Value])


Casey P said:
OK so this is what I have
= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value)

I get a Syntax Error

iif(nz(Field2) = 0, null, abs(field1 - field2))



Chris Nebinger

Casey P wrote:
This is a simple expression, I just am having issues today. I am
trying to
write an expression that show the difference between 2 fields and if
the
second field is 0 then no total would display.
 
OK so this is what I have
= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value)

I get a Syntax Error

Count parentheses and square brackets. You have no closing square
bracket after Reviewed Value, and you have two left parentheses and
only one right parenthesis. They've got to balance!

Try

= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value]))


John W. Vinson[MVP]
 

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

Similar Threads

Access Property sheet data missing also syntax 0
Access 2003 1
Sorting by Expression 6
Calculations 4
Expression to count hours for present day 6
Access Building a IIF expression in Access 0
Excel formulas in Access 4
Expressions 5

Back
Top