blank fields on a report

  • Thread starter DKnight via AccessMonster.com
  • Start date
D

DKnight via AccessMonster.com

Hi,
I am trying to run a report and I have four address lines. On the report,
if the first address line is blank, I would like to print the second address
in the field. I have coded it will the following code but it doesn't work.
What am I doing wrong?

Iif(isNull([coaddr]), [addr1], [coaddr])


Thanks in advance for any help!!
 
J

Jeff Boyce

"doesn't work" isn't particularly informative.

What happens?

Regards

Jeff Boyce
Microsoft Access MVP
 
J

Jeff Boyce

Where? In a query? In the report? In a popup? In a control?

Again, the more information you can provide us (remember, we aren't there,
and can't see what you're looking at), the better chance we have of offering
specific suggestions...

Regards

Jeff Boyce
Microsoft Access MVP

DKnight via AccessMonster.com said:
I get a #error

Jeff said:
"doesn't work" isn't particularly informative.

What happens?

Regards

Jeff Boyce
Microsoft Access MVP
Hi,
I am trying to run a report and I have four address lines. On the
report,
[quoted text clipped - 7 lines]
Thanks in advance for any help!!
 
D

DKnight via AccessMonster.com

When I am running the report. It prints out the name then the line where I
have the code, I get the # error.

Eg.

Diana Knight
# Error
Gulfport Ms ( this is the 3rd line address)

Jeff said:
Where? In a query? In the report? In a popup? In a control?

Again, the more information you can provide us (remember, we aren't there,
and can't see what you're looking at), the better chance we have of offering
specific suggestions...

Regards

Jeff Boyce
Microsoft Access MVP
I get a #error
[quoted text clipped - 13 lines]
 
J

John Spencer

IF you are using that as the source for a control you must have an equals sign
in front and the control cannot have the same name as any of the fields.
Safest thing to do is to name the control txtAddressLine1.

And since you are testing for nulls, just use the NZ function.

=NZ([CoAddr],[Addr1])

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
D

DKnight via AccessMonster.com

I tried that, still getting the #error which I think tell me that even
though the field is blank, it is not null. Is that right ?

John said:
IF you are using that as the source for a control you must have an equals sign
in front and the control cannot have the same name as any of the fields.
Safest thing to do is to name the control txtAddressLine1.

And since you are testing for nulls, just use the NZ function.

=NZ([CoAddr],[Addr1])

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Hi,
I am trying to run a report and I have four address lines. On the report,
[quoted text clipped - 5 lines]
Thanks in advance for any help!!
 
J

John Spencer

No, if the field contained spaces or a zero-length string, then the NZ
function would return the value in the field and all you would see would be blank.

Obviously, there is something else going on. Did you check the control name
to make sure that wasn't the source of the problem?

The only other thing I can think of is that there is some corruption in the
report that is causing the problem. Allen Browne has some ideas on fixing
corruption on his site.

Try Allen Browne's article on Recovering from Corruption at:
http://allenbrowne.com/ser-47.html

Also you take a look at Tony Toews' site
http://www.granite.ab.ca/access/corruptmdbs.htm

Jerry Whittle, Microsoft Access MVP has a white paper in a Word document named
Fix Corrupt Access Database towards the bottom this page:
http://www.rogersaccesslibrary.com/OtherLibraries.asp

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I tried that, still getting the #error which I think tell me that even
though the field is blank, it is not null. Is that right ?

John said:
IF you are using that as the source for a control you must have an equals sign
in front and the control cannot have the same name as any of the fields.
Safest thing to do is to name the control txtAddressLine1.

And since you are testing for nulls, just use the NZ function.

=NZ([CoAddr],[Addr1])

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Hi,
I am trying to run a report and I have four address lines. On the report,
[quoted text clipped - 5 lines]
Thanks in advance for any help!!
 

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