IIf - IsNull expression problem

C

Carol

In my report, I am trying to print a row number. If there is no row number, I
would like it to say "unknown."

If I just type in [Row] in the Control Source, it prints out the row number
just fine (without "unknown," of course.)

When I change it to =IIf(IsNull([Row]),"Unknown",[Row]) I get the dreaded
#ERROR in all rows.

When I change it to =IIf([Row] Is Null,"Unknown",[Row]) I also get #ERROR in
all rows.

I also tried =nZ([Row],"Unknown") and also got #ERROR messages.

What the #^$$&^&**@* am I doing wrong? It has to be simple. Thank you so
much for any help you can give!
 
J

Jeff Boyce

Carol

Have you tried:
Nz([YourFieldName],"unknown")

If your field name actually is "Row", you may want to change that ... I
suspect Access considered that a "reserved word", and could get confused.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

Carol

Jeff --

Thanks for responding. As you can see in my third attempt, I did try the Nz.
I looked at a list of reserved words and didn't see "Row" listed. If you
really think that is the problem, I can change that field name, but,
obviously, it will be an effort.

Jeff Boyce said:
Carol

Have you tried:
Nz([YourFieldName],"unknown")

If your field name actually is "Row", you may want to change that ... I
suspect Access considered that a "reserved word", and could get confused.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Carol said:
In my report, I am trying to print a row number. If there is no row
number, I
would like it to say "unknown."

If I just type in [Row] in the Control Source, it prints out the row
number
just fine (without "unknown," of course.)

When I change it to =IIf(IsNull([Row]),"Unknown",[Row]) I get the dreaded
#ERROR in all rows.

When I change it to =IIf([Row] Is Null,"Unknown",[Row]) I also get #ERROR
in
all rows.

I also tried =nZ([Row],"Unknown") and also got #ERROR messages.

What the #^$$&^&**@* am I doing wrong? It has to be simple. Thank you so
much for any help you can give!
 
M

Marshall Barton

Carol said:
In my report, I am trying to print a row number. If there is no row number, I
would like it to say "unknown."

If I just type in [Row] in the Control Source, it prints out the row number
just fine (without "unknown," of course.)

When I change it to =IIf(IsNull([Row]),"Unknown",[Row]) I get the dreaded
#ERROR in all rows.

When I change it to =IIf([Row] Is Null,"Unknown",[Row]) I also get #ERROR in
all rows.

I also tried =nZ([Row],"Unknown") and also got #ERROR messages.

What the #^$$&^&**@* am I doing wrong? It has to be simple. Thank you so
much for any help you can give!


It sounds like the problem is that the text box is named
Row. If it is change to to something else such as txtRow.
 
C

Carol

Thank you. Thank you. That did the trick.

Marshall Barton said:
Carol said:
In my report, I am trying to print a row number. If there is no row number, I
would like it to say "unknown."

If I just type in [Row] in the Control Source, it prints out the row number
just fine (without "unknown," of course.)

When I change it to =IIf(IsNull([Row]),"Unknown",[Row]) I get the dreaded
#ERROR in all rows.

When I change it to =IIf([Row] Is Null,"Unknown",[Row]) I also get #ERROR in
all rows.

I also tried =nZ([Row],"Unknown") and also got #ERROR messages.

What the #^$$&^&**@* am I doing wrong? It has to be simple. Thank you so
much for any help you can give!


It sounds like the problem is that the text box is named
Row. If it is change to to something else such as txtRow.
 

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