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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[HasData] function

Status
Not open for further replies.

mxfrail

MIS
Jul 7, 2008
25
0
0
US
Right now I am using [HasData] to reference whether a subreport has data but what I really want to use it for is to reference where the field within the subreport has data.

Is this possible?

If I do this - I end up with #name -

[subreport].[Report]![Jan].[HasData]=True

If I do this it works but its not quite workly the way I need it to work because its returning true even though its really false because within my crosstab the field i need does not have data but other fields in the row do.

[subreport].[Report].[HasData]=True
 
Too easy mate. Using your stem, consider this

Code:
if nz([subreport].[Report]![Jan],0)=0 then
     'it's empty
else
     'it's not empty - do something else
end if

Laterz
 
Thanks. So I took into what you gave me an example of. Everything works EXCEPT ... if nz tries to check one of the subreport fields and it doesn't exist (IE - no data/value from cross tab). I get the following error -

nzError(2427)
You entered an expression that has no value.

Is there a way to supress this error? I know it has no value. Thats what I am checking for.

My control source is below -

Code:
=IIf(NZ([subReport1].[Report]![Jan],0)<>0 and nz([subReport2].[Report]![Jan],0)<>0
,[subReport1].[Report]![Jan]+[subReport2].[Report]![Jan],iif(NZ([subReport2].[Report]![Jan],0)<>0,
[subReport2].[Report]![Jan], iif(nz([subReport1].[Report]![Jan],0)<>0,[subReport1].[Report]![Jan],"")))
 
oh my! I suspect a simpler control source would be

=Nz([subReport1].[Report]![Jan],0) + Nz([subReport2].[Report]![Jan],0)

This sets the value of each to 0 if nothing exists, otherwise it uses the value "as is"

I do wonder whether you have to reference the controls more specifally though? i wonder if it should be something more like:

=Nz(me!subreport1.report!Jan,0).......

notice the use of the word Me to substansiate the reference.

Laterz, JB



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top