Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    156

    Unanswered: Report's Format event summing

    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!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    why you didnt use a Sum function in the footer section of your subreport?
    ghozy.

  3. #3
    Join Date
    Jul 2004
    Posts
    156
    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?

    Any suggestions?
    DocX

    The teachings of God's Begotten: 2 John 1:9

  4. #4
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    you are right on that point. though I usualy use running sum property of textboxes in reports for this. could you attach the database? so I could work on it. it sounds like an interesting case.
    ghozy.

  5. #5
    Join Date
    Jul 2004
    Posts
    156
    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.
    DocX

    The teachings of God's Begotten: 2 John 1:9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •