M
MarieT
I have an unbound commission rate textbox (field) in a report,where the
commission rate value is determined in the "On Format" event, depending on
the values in some of the record fields. This commsion_rate field is then
used to calculate the commission amount textbox in the report. My problem
comes when I try to sum the commission amount at the group level. Since the
rate is unbound and determined at run-time in the "On Format" event procedure
using VBA, I can't use Sum([amount] *[rate]). I used code in VBA to add a
running balance for the group total. In the "On Format" event procedure,
after I determine the commission rate to use, I set the total_text_box to the
(rate * Amount + total_text_box). This works only if the group does not
extend beyond 1 page. When a group extends beyond one page, The total
commision amount for the group is more than it should be.
I researched the problem and found out that the On Format event may occur
more than one time across pages. I tried using the On Retreat event to
deduct the amount that was added in the On Format event, but since my
KeepTogether property is set to No, the ON Retreat event is not even
triggered: I put a breakpoint to see if this event is called, and it does not
get called unless I set the Keeptogether property for the group to Yes. In
such case, the total is even more dramatically wrong.
I don't know how to solve this problem. I am desperate at this point! The
commission amount at the detail record level is correct. The sum at the
group level is incorrect when the group extends beyond one page. I would
really appreciate your help. Please Help!
commission rate value is determined in the "On Format" event, depending on
the values in some of the record fields. This commsion_rate field is then
used to calculate the commission amount textbox in the report. My problem
comes when I try to sum the commission amount at the group level. Since the
rate is unbound and determined at run-time in the "On Format" event procedure
using VBA, I can't use Sum([amount] *[rate]). I used code in VBA to add a
running balance for the group total. In the "On Format" event procedure,
after I determine the commission rate to use, I set the total_text_box to the
(rate * Amount + total_text_box). This works only if the group does not
extend beyond 1 page. When a group extends beyond one page, The total
commision amount for the group is more than it should be.
I researched the problem and found out that the On Format event may occur
more than one time across pages. I tried using the On Retreat event to
deduct the amount that was added in the On Format event, but since my
KeepTogether property is set to No, the ON Retreat event is not even
triggered: I put a breakpoint to see if this event is called, and it does not
get called unless I set the Keeptogether property for the group to Yes. In
such case, the total is even more dramatically wrong.
I don't know how to solve this problem. I am desperate at this point! The
commission amount at the detail record level is correct. The sum at the
group level is incorrect when the group extends beyond one page. I would
really appreciate your help. Please Help!