View Full Version : SubReport HasData Problem


jv2
08-23-2004, 12:05 AM
Hello all!!

I have been trying to get this to work for a while now... but I just cant work out what is going wrong... I have used the HasData property successfully before, but no luck now.

I have a sub report "Report.NewStockMonthTotal" with the Name "NewStock". To do the calculations correctly for months that do not have any new incoming stock I need to use an IIF. I tried using an IIF in the calculation field... but it just isn't working...

Now I've stepped back a few steps and just created a textbox with a controlsource of "=IIf([NewStock].[Report].[HasData]=True,1,0)" but even this just gives me "#name?" on the report...

What is going on? Any ideas?
Your help is much appreciated.

Thanks!

J.

m0use
08-23-2004, 02:49 AM
Jv2 try the following: =IIf([Reports].[....].[HasData] etc...

Greetz, m0use

jv2
08-23-2004, 03:01 AM
I have tried
=IIf([Reports]![NewStockMonthTotal].[HasData],1,0)
and several variations of this... but they all give me the #name? error

m0use
08-23-2004, 03:06 AM
Have you tried: =IIf([Reports]![NewStockMonthTotal].[HasData]=False,1,0)...?

This seems to work for me!

m0use

jv2
08-23-2004, 03:29 AM
Yup... have tried this...
and this format worked fine before when I tried it elsewhere...
but in this report it always gives me the #name? error :mad:

any more suggestions? :confused:

jv2
08-23-2004, 07:27 AM
This is still doing my head in... :mad:

If you guys have any suggestions for a workaround... I would be more than happy to try anything... :)

I've also tried using an IIF in the subform so that the sums textbox displays 0 if the fields to be summed are null. this works correctly on the subform... but when I use that sum reference in the main form... it still gives me #error.

HELP!!! :)

Rich
08-23-2004, 10:05 AM
Your syntax is almost certainly incorrect, use the Code builder to get the correct References to your subReport and control

jv2
08-24-2004, 01:31 AM
Rich,
Which one of the syntaxes were you referring to? I have tried so many different ways of doing it... obviously starting with what I though was the correct way...
I have also tried using the the expression builder... but it's no help.
Besides... I cantr find the HasData property on the expression builder... :(

Rich
08-24-2004, 01:52 AM
=IIf([NewStockMonthTotal].[Report].[HasData],1,0)

jv2
08-24-2004, 01:55 AM
Using this just causes the report to ask me for a value for the NewStockMonthTotal variable.

Report is called "NewStockMonthTotal" - The subform control is named "NewStock"

any more suggestions? :)

Please? :rolleyes:

Rich
08-24-2004, 01:58 AM
Using this just causes the report to ask me for a value for the NewStockMonthTotal variable.

Report is called "NewStockMonthTotal" - The subform control is named "NewStock"

any more suggestions? :)

Please? :rolleyes:

Then it's just [NewStock] instead of [NewStockMonthTotal]

jv2
08-24-2004, 02:31 AM
You think I haven't tried that? :D

:confused:

Rich
08-24-2004, 02:38 AM
It's the name of the subReport as it appears on the main report Property sheet, not the name in the DB Window

jv2
08-24-2004, 03:12 AM
as far as I know... the main report property sheet does not refer to the subreport...
right clicking on the subreport control and selecting the properties shows me:
name: NewStock
SourceObject: Report.NewStockMonthTotal
I have tried several methods of referring to this £%^"$% report and it's just having none of it... :mad:

Rich
08-24-2004, 12:24 PM
Open the main report in design view, open the property sheet, click the subReport control, click the Other tab on the property sheet, the Name you need is there

jv2
08-25-2004, 12:57 AM
It has not changed since the first post :) it is still "NewStock"
and it does not work with any of these references. :(
Any ideas on what is causing this?
Or what I could do to work around this problem?

Cheers.

Rich
08-25-2004, 11:47 AM
post a 97ver of your db here

jv2
08-26-2004, 01:06 AM
wouldn't I just be so happy if I could do that... I'm stuck with Access 2.0 :mad:
and I would attach that here If I could... it says file size limit for zip 100k... even tried stripping some stuff out from it :) but no help... you can now find it at http://www14.brinkster.com/jv2jv2/stationeryDB.zip
Think you should be able to view it... if you go to reporting and select either january or february... and then click on the top left report (monthly something) you will find that there is a test box on the left which gives the #name? error... also... if you select "March" and then run the report... all the sums give errors... that is the reason Im trying to get this to work... as if there is no "newStock" deliveries in a particular month... then the calculations f*up...

Rich
08-26-2004, 01:49 AM
Access 2.0, isn't that Access95? if it is then I'm not sure that the HasData method was available.

Your link doesn't work :confused:

jv2
08-26-2004, 02:01 AM
I think it is an earlier version..not 95... think it came out either 93 or 94... too old anyway :)
I have now built 4 databases in it... and have used the HasData successfully elsewhere.

jv2
08-26-2004, 02:20 AM
whoops... didnt notice the link thingy...
it worked for me when I tested it... but it was because I was logged in to the file upload thing
open the page http://www14.brinkster.com/jv2jv2/ then open http://www14.brinkster.com/jv2jv2/stationeryDB.zip in another window :) hehehe sorry... cant be bothered to do a page with a link right now :o

jv2
08-27-2004, 02:11 AM
please please please somebody come up with a nice workaround for this issue... Im dying here!!!!
C'mon Rich... Been looking at your posts elsewhere... You're a smart cookie... I know you can do it :)

Rich
08-27-2004, 04:12 AM
Aside from not being able to figure out what does what in your db I can't see anything wrong with the HasData on your Report.
It would appear to be returning 1

jv2
08-27-2004, 04:18 AM
haha... yeah Im sure it's a bit of a mess.. but it does what it's supposed to do... :)
but hmm... so it returns a value for you... very interesting... so in other words there doesnt seem to be anything wrong with it if opened in a newer version of access... but here Im still getting #name? which is really bugging me, since I have used the HasData method before and had it working fine...