Should the following IIF statments work?

P

pgarcia

Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])
 
S

storrboy

Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])


I think the False condition is required. IIF(condition, do if true, do
if false).
 
W

Wayne-I-M

Yes they are fine - provideing you don't want to see any results if they IIf
is false
Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT true.

Hope this helps

--
Wayne
Manchester, England.



pgarcia said:
Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])
 
P

pgarcia

Ok, I put a "False" statement in the express and it still does not work. I do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they IIf
is false
Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT true.

Hope this helps

--
Wayne
Manchester, England.



pgarcia said:
Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])
 
D

Douglas J. Steele

What is Expr12? A calculated field in a query? You cannot refer to
calculated fields in that way: you have to repeat whatever calculation it is
you've assigned to the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


pgarcia said:
Ok, I put a "False" statement in the express and it still does not work. I
do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they
IIf
is false
Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination
you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like
this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT
true.

Hope this helps

--
Wayne
Manchester, England.



pgarcia said:
Should the following IIF statments work? I get blank cells. FYI, It's
text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center])
 
P

pgarcia

Thanks, how should I do that?

Douglas J. Steele said:
What is Expr12? A calculated field in a query? You cannot refer to
calculated fields in that way: you have to repeat whatever calculation it is
you've assigned to the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


pgarcia said:
Ok, I put a "False" statement in the express and it still does not work. I
do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they
IIf
is false

Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination
you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like
this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT
true.

Hope this helps

--
Wayne
Manchester, England.



:

Should the following IIF statments work? I get blank cells. FYI, It's
text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center])
 
P

pgarcia

I thought about somthing, I already have an IIF statment that does that and
it works:

Expr12: IIf([CVR 6TH RUN]![Expr11]=[CVR 6TH RUN]![Expr10],[CVR 6TH
RUN]![Expr11],[CVR 6TH RUN]![Expr10])

Douglas J. Steele said:
What is Expr12? A calculated field in a query? You cannot refer to
calculated fields in that way: you have to repeat whatever calculation it is
you've assigned to the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


pgarcia said:
Ok, I put a "False" statement in the express and it still does not work. I
do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they
IIf
is false

Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination
you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like
this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT
true.

Hope this helps

--
Wayne
Manchester, England.



:

Should the following IIF statments work? I get blank cells. FYI, It's
text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center])
 
Top