Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#ERROR in Sub - Report

Status
Not open for further replies.

Patricha

Programmer
Oct 19, 2000
9
US
I am in need of much help here.... kind of new to sub-reports.
My main report works fine and I have the sub report linked fine.

The problem is when there are no records in the subreport

Ok I have a sub-report that the record source is a sql

SELECT id,count(datemailed) as DateLetterMailedOut
FROM tblProduct
WHERE ContactType = "Mail"
GROUP BY id;

and when there are records the text box is populated.
what I want to be able to do is when there are no records found to show
0 (Zero) as the count

I tried putting in the control source of the text box

=iif(isnull([DateLetterMailed]),0,[DateLetterMailed])

then I tried
=iif(isnull([DateLetterMailed]),"0",[DateLetterMailed])

then I tried
=iif(isnull([datemailed]),0,[datemailed])

and I tried
=iif(isnull([datemailed]),"0",[datemailed])
and none of these worked.....

If anyone knows what I am doing wrong or has another solution, PLEASE HELP!!!

Thanks
Andrew
[sig][/sig]
 
Well one clue that the syntax is wrong is when it does not capitalize the "I" in Iff

So try
Code:
"Is null"
as two words not one
Code:
"isnull"

Second the quotes "" for the Zero are only needed if the DateLetterMailed field is a String. If its a number then you don't need quotes.
And Get the exact spelling of the field from the table or somewhere and paste it in the Windows clipboard or even in a Blank Notepad doc so you are 100% sure its spelled correct. And then paste it in your code by pressing Ctrl-C when you need to.

Also make sure that you infact have the DateLetterMailed field in your query if that what you are using. [sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top