IIf question

R

RVS

I have a field [Same] that denotes whether someone's street address is the
same as their mailing address. If it is the same, I enter a "Y" for that
field. If it is diffeent, I enter a "N". I have another field called [Alt
Street], which will list the alternate street address if there is a
different address, or it will have the actual street address if the street
address is the mailing address.

In a report I have created, I have a line in the report that will list the
alternate street if the SAME field is "N", but will otherwise be blank.

Here is my IIf satement that has something wrong with it:

=IIf([Same]="N", [Alt Street] , " ")

Can anyone point me in the right direction here?
 
R

RVS

I get the following in that field:

#Error


Lynn Trapp said:
What results are you getting now? The syntax appears to be correct.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Security FAQ: http://support.microsoft.com/support/access/content/secfaq.asp



RVS said:
I have a field [Same] that denotes whether someone's street address is the
same as their mailing address. If it is the same, I enter a "Y" for that
field. If it is diffeent, I enter a "N". I have another field called [Alt
Street], which will list the alternate street address if there is a
different address, or it will have the actual street address if the street
address is the mailing address.

In a report I have created, I have a line in the report that will list the
alternate street if the SAME field is "N", but will otherwise be blank.

Here is my IIf satement that has something wrong with it:

=IIf([Same]="N", [Alt Street] , " ")

Can anyone point me in the right direction here?
 
B

Brendan Reynolds

I can't see anything obviously wrong with the IIf() expression. One
possibility is that the 'Same' field might be formatted to show the text in
uppercase, even if it is entered in lowercase. If you think that might be
the problem, try the following ...

IIf(UCase$([Same]) = "N", [Alt Street], " ")

If that's not it, try posting a little more detail - what result are you
getting at the moment? An error? A space when you're expecting the value of
[Alt Street]? Or the value of [Alt Street] when your expecting a space?
 
R

RVS

Sorry, meant to reply to group

I get the following in that field:

#Error



Lynn Trapp said:
What results are you getting now? The syntax appears to be correct.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Security FAQ: http://support.microsoft.com/support/access/content/secfaq.asp



RVS said:
I have a field [Same] that denotes whether someone's street address is the
same as their mailing address. If it is the same, I enter a "Y" for that
field. If it is diffeent, I enter a "N". I have another field called [Alt
Street], which will list the alternate street address if there is a
different address, or it will have the actual street address if the street
address is the mailing address.

In a report I have created, I have a line in the report that will list the
alternate street if the SAME field is "N", but will otherwise be blank.

Here is my IIf satement that has something wrong with it:

=IIf([Same]="N", [Alt Street] , " ")

Can anyone point me in the right direction here?
 
T

tina

are the fields [Same] and [Alt Street] included in the
report's underlying query or SQL statement?
also, what is the name of the calculated control in the
report? if it's "Same" or "Alt Street", that's a circular
reference in Access and it will err.
hth

-----Original Message-----
I get the following in that field:

#Error


What results are you getting now? The syntax appears to be correct.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Security FAQ: http://support.microsoft.com/support/access/content/secfaq ..asp



RVS said:
I have a field [Same] that denotes whether someone's
street address is
the enter a "Y" for
that
field. If it is diffeent, I enter a "N". I have
another field called
[Alt
Street], which will list the alternate street address if there is a
different address, or it will have the actual street
address if the
street report that will list
the
alternate street if the SAME field is "N", but will otherwise be blank.

Here is my IIf satement that has something wrong with it:

=IIf([Same]="N", [Alt Street] , " ")

Can anyone point me in the right direction here?


.
 
R

RVS

That was it!

It was a circular reference back to Alt Street.

Problem solved, many thanks.

tina said:
are the fields [Same] and [Alt Street] included in the
report's underlying query or SQL statement?
also, what is the name of the calculated control in the
report? if it's "Same" or "Alt Street", that's a circular
reference in Access and it will err.
hth

-----Original Message-----
I get the following in that field:

#Error


What results are you getting now? The syntax appears to be correct.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Security FAQ: http://support.microsoft.com/support/access/content/secfaq .asp



I have a field [Same] that denotes whether someone's
street address is
the
same as their mailing address. If it is the same, I
enter a "Y" for
that
field. If it is diffeent, I enter a "N". I have another field called
[Alt
Street], which will list the alternate street address if there is a
different address, or it will have the actual street
address if the
street
address is the mailing address.

In a report I have created, I have a line in the
report that will list
the
alternate street if the SAME field is "N", but will otherwise be blank.

Here is my IIf satement that has something wrong with it:

=IIf([Same]="N", [Alt Street] , " ")

Can anyone point me in the right direction here?


.
 

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

Top