IIf + Null value + #Error

  • Thread starter Thread starter Opal
  • Start date Start date
O

Opal

I have an unbound textbox in a report in Access 2003.

I have the following as its control source:

=IIf([Cassette subreport].Report!CassetteName="",Null,[Cassette
subreport].Report!CassetteName)

Basically, if there is a null value in the Subreport I want a null
value in the
textbox. Right now I am getting "#Error" in the textbox if there is
no value
in the subreport. It works fine if there is a value in the
subreport.....

Can anyone help?
 
I have an unbound textbox in a report in Access 2003.

I have the following as its control source:

=IIf([Cassette subreport].Report!CassetteName="",Null,[Cassette
subreport].Report!CassetteName)

Basically, if there is a null value in the Subreport I want a null
value in the
textbox.  Right now I am getting "#Error" in the textbox if there is
no value
in the subreport.  It works fine if there is a value in the
subreport.....

Can anyone help?


I have also tried:

=IIf(IsNull([Cassette subreport].Report!CassetteName),"",[Cassette
subreport].Report!CassetteName)

With the same results....
 
If the subreport doesn't return any records, you need to use HasData

=IIf([Cassette subreport].Report.HasData, [Cassette
subreport].Report!CassetteName, Null)

--
Duane Hookom
Microsoft Access MVP


Opal said:
On FeI
I have an unbound textbox in a report in Access 2003.

I have the following as its control source:

=IIf([Cassette subreport].Report!CassetteName="",Null,[Cassette
subreport].Report!CassetteName)

Basically, if there is a null value in the Subreport I want a null
value in the
textbox. Right now I am getting "#Error" in the textbox if there is
no value
in the subreport. It works fine if there is a value in the
subreport.....

Can anyone help?


I have also tried:

=IIf(IsNull([Cassette subreport].Report!CassetteName),"",[Cassette
subreport].Report!CassetteName)

With the same results....
 
If the subreport doesn't return any records, you need to use HasData

=IIf([Cassette subreport].Report.HasData, [Cassette
subreport].Report!CassetteName, Null)

--
Duane Hookom
Microsoft Access MVP

Opal said:
I have an unbound textbox in a report in Access 2003.
I have the following as its control source:
=IIf([Cassette subreport].Report!CassetteName="",Null,[Cassette
subreport].Report!CassetteName)
Basically, if there is a null value in the Subreport I want a null
value in the
textbox.  Right now I am getting "#Error" in the textbox if there is
no value
in the subreport.  It works fine if there is a value in the
subreport.....
Can anyone help?
I have also tried:
=IIf(IsNull([Cassette subreport].Report!CassetteName),"",[Cassette
subreport].Report!CassetteName)
With the same results....- Hide quoted text -

- Show quoted text -

Thank you, thank you, thank you Duane!
 
Opal said:
I have an unbound textbox in a report in Access 2003.

I have the following as its control source:

=IIf([Cassette subreport].Report!CassetteName="",Null,[Cassette
subreport].Report!CassetteName)

Basically, if there is a null value in the Subreport I want a null
value in the
textbox. Right now I am getting "#Error" in the textbox if there is
no value
in the subreport. It works fine if there is a value in the
subreport.....


If the subreport has no records to process, then there is no
value to check, not even Null. In this case, use:

=IIf([Cassette subreport].Report.HasData, [Cassette
subreport].Report!CassetteName, Null)

If there is some data in the subreport, then you could use:

=IIf(Nz([Cassette subreport].Report.CassetteName, "") = "",
Null, [Cassette subreport].Report!CassetteName)
 
Back
Top