IIf - IsNull expression problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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
 
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!
 
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.
 
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.
 
Back
Top