A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Writing Expressions in Access



 
 
Thread Tools Display Modes
  #1  
Old September 5th, 2006, 04:14 PM posted to microsoft.public.access.gettingstarted
Casey P
external usenet poster
 
Posts: 1
Default Writing Expressions in Access

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.
  #2  
Old September 5th, 2006, 04:19 PM posted to microsoft.public.access.gettingstarted
[email protected]
external usenet poster
 
Posts: 35
Default Writing Expressions in Access

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.


  #3  
Old September 5th, 2006, 04:19 PM posted to microsoft.public.access.gettingstarted
[email protected]
external usenet poster
 
Posts: 35
Default Writing Expressions in Access

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.


  #4  
Old September 5th, 2006, 04:32 PM posted to microsoft.public.access.gettingstarted
Casey P
external usenet poster
 
Posts: 28
Default Writing Expressions in Access

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

I get a Syntax Error

" wrote:

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.



  #5  
Old September 5th, 2006, 04:38 PM posted to microsoft.public.access.gettingstarted
Casey P
external usenet poster
 
Posts: 28
Default Writing Expressions in Access

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.


" wrote:

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.



  #6  
Old September 5th, 2006, 04:53 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default Writing Expressions in Access

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" wrote in message
...
OK so this is what I have
= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value)

I get a Syntax Error

" wrote:

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.





  #7  
Old September 5th, 2006, 05:03 PM posted to microsoft.public.access.gettingstarted
Casey P
external usenet poster
 
Posts: 28
Default Writing Expressions in Access

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

Thanks sir.

"John Spencer" wrote:

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" wrote in message
...
OK so this is what I have
= iif(Reviewed Value) = 0, null, ([Complete Date] - [Reviewed Value)

I get a Syntax Error

" wrote:

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.





  #8  
Old September 5th, 2006, 05:13 PM posted to microsoft.public.access.gettingstarted
John Vinson
external usenet poster
 
Posts: 4,033
Default Writing Expressions in Access

On Tue, 5 Sep 2006 08:32:01 -0700, Casey P
wrote:

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]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.