EXPRESSION EQUATION

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

Guest

I am putting the following equation in my expression.
[nDIST]-[nPP1DIS]>1.5 When this occurs I wont show anything on the screen.

When [nDIST] = 6 and [nPP1DIS] = 8 I would assume the results would be a -2
an d it would show that field on the screen. That field doesnt appear on the
screen. What am I doing wrong and how can I correct it?
Thanks for any help
ed
 
ed,

You don't say where you are putting this equation. I will
assume it is in a control on a form or report .... ?

You want to use an immediate if statement to evaluate your
equation and do the corresponding calculation. Try:

IIF ([nDIST]-[nPP1DIS]>1.5, "",[nDIST]-[nPP1DIS])

The two double quotes after the first comma will display
nothing if the result is greater that 1.5 otherwise
perform the calculation [nDIST]-[nPP1DIS].

If I have misunderstood or you need more assistance pls
post back.

HTH

Terry
 
Terry
I go into Access Report Design View. Click on a field. Then go to
Conditional Fotmatting.. Then into Expression is. Im going to be usings two
fields [nDIST] and [nPP1DIS]. Here is what I want to accomplish.
1. Whenever [nDIST] is 1.5 > [nPP1DIS] I want [nPP1DIS] field in the view
mode to display nothing. When [nDIST] is <1.5[nPP1DIS] I want the nPP1DIS
number to be displayed.
2. Whenever [nDIST] is 1.5 < [nPP1DIS] I want [nPP1DIS] field in the display
mode to show nothing. And when it isnt to display [nPP1DIS].

Basically what Im trying to explain is when the difference between [nDIST]
and [nPP1DIS] is less than 1.5 I want the field in [nPP1DIS] to be blank,
but when it is less than 1.5 I want to the [nPP1DIS] to display whatever
number is in there.

Note sometimes the difference between [nDIST] and [nPP1DIS] will be positive
and sometimes it will be negative.

Your formula IIf([nDIST]-[nPP1DIS]>1.5,"",Etc wouldnt work because it would
display the difference between [nDIST] and [nPP1DIS] when I only wanted to
see [nPP1DIS]
I sure hope I havent totally confused you .If I did please say so and I will
try and explain it another way.
Sure appreciate the help
ed

Terry said:
ed,

You don't say where you are putting this equation. I will
assume it is in a control on a form or report .... ?

You want to use an immediate if statement to evaluate your
equation and do the corresponding calculation. Try:

IIF ([nDIST]-[nPP1DIS]>1.5, "",[nDIST]-[nPP1DIS])

The two double quotes after the first comma will display
nothing if the result is greater that 1.5 otherwise
perform the calculation [nDIST]-[nPP1DIS].

If I have misunderstood or you need more assistance pls
post back.

HTH

Terry
-----Original Message-----
I am putting the following equation in my expression.
[nDIST]-[nPP1DIS]>1.5 When this occurs I wont show anything on the screen.

When [nDIST] = 6 and [nPP1DIS] = 8 I would assume the results would be a -2
an d it would show that field on the screen. That field doesnt appear on the
screen. What am I doing wrong and how can I correct it?
Thanks for any help
ed
.
 
Ed,

What you are attempting to do makes more sense now .... I
think.

In the control source of your control something like:
=iif(abs([ndist]-[npp1dis])>1.5,"",[npp1dis])

Bit by bit this formula is:

iif an immediate if statement

abs which returns an absolute value eg abs(1) and abs(-1)
will return 1. This will effectively turn the difference
into a positive number no matter what.

The "" is a blank string which will be used if abs([ndist]-
[npp1dis])>1.5

If less than 1.5 then [npp1dis] will display.

Best of luck,

Terry
-----Original Message-----
Terry
I go into Access Report Design View. Click on a field. Then go to
Conditional Fotmatting.. Then into Expression is. Im going to be usings two
fields [nDIST] and [nPP1DIS]. Here is what I want to accomplish.
1. Whenever [nDIST] is 1.5 > [nPP1DIS] I want [nPP1DIS] field in the view
mode to display nothing. When [nDIST] is <1.5[nPP1DIS] I want the nPP1DIS
number to be displayed.
2. Whenever [nDIST] is 1.5 < [nPP1DIS] I want [nPP1DIS] field in the display
mode to show nothing. And when it isnt to display [nPP1DIS].

Basically what Im trying to explain is when the difference between [nDIST]
and [nPP1DIS] is less than 1.5 I want the field in [nPP1DIS] to be blank,
but when it is less than 1.5 I want to the [nPP1DIS] to display whatever
number is in there.

Note sometimes the difference between [nDIST] and [nPP1DIS] will be positive
and sometimes it will be negative.

Your formula IIf([nDIST]-[nPP1DIS]>1.5,"",Etc wouldnt work because it would
display the difference between [nDIST] and [nPP1DIS] when I only wanted to
see [nPP1DIS]
I sure hope I havent totally confused you .If I did please say so and I will
try and explain it another way.
Sure appreciate the help
ed

Terry said:
ed,

You don't say where you are putting this equation. I will
assume it is in a control on a form or report .... ?

You want to use an immediate if statement to evaluate your
equation and do the corresponding calculation. Try:

IIF ([nDIST]-[nPP1DIS]>1.5, "",[nDIST]-[nPP1DIS])

The two double quotes after the first comma will display
nothing if the result is greater that 1.5 otherwise
perform the calculation [nDIST]-[nPP1DIS].

If I have misunderstood or you need more assistance pls
post back.

HTH

Terry
-----Original Message-----
I am putting the following equation in my expression.
[nDIST]-[nPP1DIS]>1.5 When this occurs I wont show anything on the screen.

When [nDIST] = 6 and [nPP1DIS] = 8 I would assume the results would be a -2
an d it would show that field on the screen. That
field
doesnt appear on the
screen. What am I doing wrong and how can I correct it?
Thanks for any help
ed
.
.
 
Hi Terry
When I entered your equation IIF(ABS([NDIST]-[NPP1DIS])>1.5,"",[NPP1DIS])
I got the following error message. You may have entered a comma without
preceding value or identifier.
I tried moving the ( around but that didnt help. I know a field always has
a bracket around it, but I dont know how to use (. I believe your formula
will work once we find why I cant use it. I sure wish I could help you more.
I hope its just a minor change.
Sure appreciate the help
ed

Terry said:
Ed,

What you are attempting to do makes more sense now .... I
think.

In the control source of your control something like:
=iif(abs([ndist]-[npp1dis])>1.5,"",[npp1dis])

Bit by bit this formula is:

iif an immediate if statement

abs which returns an absolute value eg abs(1) and abs(-1)
will return 1. This will effectively turn the difference
into a positive number no matter what.

The "" is a blank string which will be used if abs([ndist]-
[npp1dis])>1.5

If less than 1.5 then [npp1dis] will display.

Best of luck,

Terry
-----Original Message-----
Terry
I go into Access Report Design View. Click on a field. Then go to
Conditional Fotmatting.. Then into Expression is. Im going to be usings two
fields [nDIST] and [nPP1DIS]. Here is what I want to accomplish.
1. Whenever [nDIST] is 1.5 > [nPP1DIS] I want [nPP1DIS] field in the view
mode to display nothing. When [nDIST] is <1.5[nPP1DIS] I want the nPP1DIS
number to be displayed.
2. Whenever [nDIST] is 1.5 < [nPP1DIS] I want [nPP1DIS] field in the display
mode to show nothing. And when it isnt to display [nPP1DIS].

Basically what Im trying to explain is when the difference between [nDIST]
and [nPP1DIS] is less than 1.5 I want the field in [nPP1DIS] to be blank,
but when it is less than 1.5 I want to the [nPP1DIS] to display whatever
number is in there.

Note sometimes the difference between [nDIST] and [nPP1DIS] will be positive
and sometimes it will be negative.

Your formula IIf([nDIST]-[nPP1DIS]>1.5,"",Etc wouldnt work because it would
display the difference between [nDIST] and [nPP1DIS] when I only wanted to
see [nPP1DIS]
I sure hope I havent totally confused you .If I did please say so and I will
try and explain it another way.
Sure appreciate the help
ed

Terry said:
ed,

You don't say where you are putting this equation. I will
assume it is in a control on a form or report .... ?

You want to use an immediate if statement to evaluate your
equation and do the corresponding calculation. Try:

IIF ([nDIST]-[nPP1DIS]>1.5, "",[nDIST]-[nPP1DIS])

The two double quotes after the first comma will display
nothing if the result is greater that 1.5 otherwise
perform the calculation [nDIST]-[nPP1DIS].

If I have misunderstood or you need more assistance pls
post back.

HTH

Terry

-----Original Message-----
I am putting the following equation in my expression.
[nDIST]-[nPP1DIS]>1.5 When this occurs I wont show
anything on the screen.

When [nDIST] = 6 and [nPP1DIS] = 8 I would assume the
results would be a -2
an d it would show that field on the screen. That field
doesnt appear on the
screen. What am I doing wrong and how can I correct it?
Thanks for any help
ed
.
.
 
Back
Top