HasData method

AccessWater

Registered User.
Local time
Today, 13:34
Joined
Jun 14, 2006
Messages
52
I am trying to use HasData method to get SUM using subreport data. Attached is an example I did. But it still asks me to enter the .hasData parameter.

Could anyone tell me what I did wrong? Why it does not work.

Rich, if you are there, could you please give me a hand again?

Thank you very much.
 

Attachments

Hello,

Good question. I have the same problems.

My e-mail is geert678@hotmail.com

if you have it solved, please send me your good example,

Regards,

Geert (From Belgium)
 
Unless you post a 97ver I can't open it
 
I am not able to convert my example to 97 Version. Can anyone help me with that?

Thanks a lot.
 
You can't use HasData the way you try to....
According to Access Help:

You can use the HasData property to determine if a form or report is bound to an empty recordset.
You can get the value of the HasData property by using a macro or Visual Basic.

I'm not quite sure what you're after but seems that you're trying to return a sum of 0 (zero) if your subreport doesn't return any values for your month column.
What you need to do is to base your reports on queries.
Use the Nz function in your queries to decode null values to zero's.
Add an unbound control to totlalize your budgets.

You really should start normalizing your data structure.
You should define columns for each month in your tables.
You should store rows using a data column.

RV
 
Hello,

I convert your example to version 97.

I have also a budget en actuals and i want to see the sum between the budget and actual per month.

I worked always with Excel but now i have too much rules.

Your example is great for me. I hope that you get a good example.

Regards,

Geert
(From Belgium)
 

Attachments

Hi, RV,

Thanks for your reply.

I am new to Access, so I am not sure I know how to do what you said.

Basically, I want to get group sum in my report using the budget number from a subreport. Many previous posts suggested using HasData method. But so far, it is not working for me. And I could not figure out what went wrong.

Currently, if I only use IIF() funtion, there is no request for .HadData parameter when I run the report. And of course, it did not give me a sum. When I add SUM() function outside of IIF () function, it asks for .HasData parameter. Hope this gives you more info.

Geert, Thank you very much for coverting the file to 97 version. Definitely, I will let you know if I got the solution.

Olivia
 
Last edited:
Hello Olivia,

Thanks for your reaction.

I am also a newby in Access.

I am looking for a example with the next fields:
Actual
Budget
diffActualBudget
Account
Cost
I have difficulties with the relationships en amounts of zere.

I will be appreciate 1f you have a example for me. I will see if you have a solution. My e-mail adres is geert678@hotmail.com

Regards,

Geert
(From Belgium)
 
Hi, Geert,

After carefully studied Rich's another HAsData example, I finally got it. I attached both Rich's example and the one I used.

The problem I had is that there is no need to use SUM() function outside of IIF() function. First, you use SUM() function in the subreport to get sum. In the detail section of main report, you use IIF () function with "runing sum" set up as Over ALL or Over Group according to your own purpose. You can set this textbox Invisiable if you do not want it be shown in the report.

Then in your group rooter or report rooter, create another text box and its control sources is = [The Name of the textbox where IIF() is].

Hope this helps.

Olivia
 

Attachments

Hoi Olivia,

Thanks for your examples.

I will study the structure.

I have also the fields: Cost-unit, account and periode.

Perhaps i must do normalition my database.

Keep me on information.

Regards,

Geert
 

Users who are viewing this thread

Back
Top Bottom