In my detail section on my report, I have a text box whose control source is an IIf function. In the format event of the detail section, I have code that adds the value of the text box to my public variable holding this running sum. The report footer has a text box which is set to this public variable. This report is a subreport on a main report and both are linked by a value.
Whenever this subreport is run standalone, the sum performs correctly. However, when it is placed as a subreport on the main form, it gives a value exactly twice the value it should be. I'll also note that my subreport's Open event sets the public variable to 0 so that the value will not carry over between subreports. Can anyone help? Thanks!
I don't believe you can use Sum functions on text boxes that aren't a field of the underlying data. On top of that, this is an IIf function. I tried, but it kept asking me for the value of the text box I was entering to sum.
I had thought about running a query on the query that I'm using as the record source for the subreport and using an IIf function in the last query instead of on the report, but I figured that would slow down the speed of the query and cause a bad lag. Am I right?
All right. I'll try to filter out all the sensitive information before I send it. Plus, I've got a bunch of junk objects in it, so I'll have to send you just the basics. I'll post it soon, hopefully.
I have thought about just dividing the total by 2 to get the number it needs, but I'm afraid that it just HAPPENS to be a multiple of 2 with the data I'm running and/or by chance. If I could catch where it's "happening twice," I would be happy. It's somewhere with the formatting of a subreport since it works perfectly as a standalone report.