Problem with IIF statement

G

Guest

I'm having trouble getting my IIF statemet to work in one of my reports. I
would like to return the text "Liability Insurance" if there is a value in
the "liability_insurance_end_date" field, otherwise return the data in the
field called "reminder_type". The problem I'm having is with the
"reminder_type" field. If I just put in some text for debugging purposes it
works fine. However, when I try to get the value out of the field I get a
#Error on my report. If I completely remove the IIF statement and just put
the "reminder_type" field in the control source it works just fine and
returns the value in the field. However, I need it to work in the IIF
statement. Any ideas on how to fix this? My code in the control source is
below.

=IIf([liability_insurance_end_date] Is Not Null,"Liability
Insurance",[reminder_type])

Thanks,

rone
 
B

BruceM

Is [reminder_type] in the report's record source? Can you bind a text box
to the [reminder_type] field? Do you get the #Error if the control source
is =[reminder_type]?
 
K

kingston via AccessMonster.com

Both fields [liability_insurance_end_date] and [reminder_type] must be in the
report for you to refer to them in another textbox's expression (i.e. you
will end up with three textboxes - [liability_insurance_end_date],
[reminder_type], and [calculated field]). Make them invisible if you want to
hide them from the user.
I'm having trouble getting my IIF statemet to work in one of my reports. I
would like to return the text "Liability Insurance" if there is a value in
the "liability_insurance_end_date" field, otherwise return the data in the
field called "reminder_type". The problem I'm having is with the
"reminder_type" field. If I just put in some text for debugging purposes it
works fine. However, when I try to get the value out of the field I get a
#Error on my report. If I completely remove the IIF statement and just put
the "reminder_type" field in the control source it works just fine and
returns the value in the field. However, I need it to work in the IIF
statement. Any ideas on how to fix this? My code in the control source is
below.

=IIf([liability_insurance_end_date] Is Not Null,"Liability
Insurance",[reminder_type])

Thanks,

rone
 
B

BruceM

Ah, yes. I forgot that part about needing to put the hidden text box into
the report, as it isn't enough just to have the field in the record source.

kingston via AccessMonster.com said:
Both fields [liability_insurance_end_date] and [reminder_type] must be in
the
report for you to refer to them in another textbox's expression (i.e. you
will end up with three textboxes - [liability_insurance_end_date],
[reminder_type], and [calculated field]). Make them invisible if you want
to
hide them from the user.
I'm having trouble getting my IIF statemet to work in one of my reports.
I
would like to return the text "Liability Insurance" if there is a value in
the "liability_insurance_end_date" field, otherwise return the data in the
field called "reminder_type". The problem I'm having is with the
"reminder_type" field. If I just put in some text for debugging purposes
it
works fine. However, when I try to get the value out of the field I get a
#Error on my report. If I completely remove the IIF statement and just
put
the "reminder_type" field in the control source it works just fine and
returns the value in the field. However, I need it to work in the IIF
statement. Any ideas on how to fix this? My code in the control source
is
below.

=IIf([liability_insurance_end_date] Is Not Null,"Liability
Insurance",[reminder_type])

Thanks,

rone
 
F

fredg

I'm having trouble getting my IIF statemet to work in one of my reports. I
would like to return the text "Liability Insurance" if there is a value in
the "liability_insurance_end_date" field, otherwise return the data in the
field called "reminder_type". The problem I'm having is with the
"reminder_type" field. If I just put in some text for debugging purposes it
works fine. However, when I try to get the value out of the field I get a
#Error on my report. If I completely remove the IIF statement and just put
the "reminder_type" field in the control source it works just fine and
returns the value in the field. However, I need it to work in the IIF
statement. Any ideas on how to fix this? My code in the control source is
below.

=IIf([liability_insurance_end_date] Is Not Null,"Liability
Insurance",[reminder_type])

Thanks,

rone

=IIf(IsNull([liability_insurance_end_date]),[Reminder Type],"Liability
Insurance")

Make sure the name of this control is not the same as the name of any
field used in it's control source expression.
 
G

Guest

Thanks fredg...that solved the problem. I just changed the name of the text
box and it worked....wish all of lifes problems were that simple.!
--
Rone


fredg said:
I'm having trouble getting my IIF statemet to work in one of my reports. I
would like to return the text "Liability Insurance" if there is a value in
the "liability_insurance_end_date" field, otherwise return the data in the
field called "reminder_type". The problem I'm having is with the
"reminder_type" field. If I just put in some text for debugging purposes it
works fine. However, when I try to get the value out of the field I get a
#Error on my report. If I completely remove the IIF statement and just put
the "reminder_type" field in the control source it works just fine and
returns the value in the field. However, I need it to work in the IIF
statement. Any ideas on how to fix this? My code in the control source is
below.

=IIf([liability_insurance_end_date] Is Not Null,"Liability
Insurance",[reminder_type])

Thanks,

rone

=IIf(IsNull([liability_insurance_end_date]),[Reminder Type],"Liability
Insurance")

Make sure the name of this control is not the same as the name of any
field used in it's control source expression.
 

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

IIF statement help 13
IIf statement 2
Group SubTotal with condition 2
IIF statement 2
problem with IIf Statement 7
Show phrase when no data for a report 2
Iif Statement with Null Values 2
IIF statement 5

Top