IIf + Null value + #Error

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?
 
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 also tried:

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

With the same results....
 
D

Duane Hookom

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....
 
O

Opal

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!
 
M

Marshall Barton

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)
 

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