Conditional Page Footer

  • Thread starter Thread starter Amy E. Baggott
  • Start date Start date
A

Amy E. Baggott

I have an invoice report in which the page footer is a remittal slip. I
would like to have the page footer only be visible if they have a balance
due. I run the invoices as a batch. I know I should put it in an event, but
what event do I put it in so that it will be visible on the orders that have
a balance and not on the orders that don't?
 
Amy said:
I have an invoice report in which the page footer is a remittal slip. I
would like to have the page footer only be visible if they have a balance
due. I run the invoices as a batch. I know I should put it in an event, but
what event do I put it in so that it will be visible on the orders that have
a balance and not on the orders that don't?


This will probably need refinement after you clarify the
details of your report, but try this kind of code in the
page footer section's Format event procedure:
Cancel = (Me.balance = 0)
 
I had figured on having the code read something along the lines of:

If me.balance <= 0 then
me.pagefooter.visible = false
Else
me.pagefooter.visible = true
End If

I just wasn't sure where to put it. You're saying the Format event will
recalculate it for each page?
 
Amy said:
I had figured on having the code read something along the lines of:

If me.balance <= 0 then
me.pagefooter.visible = false
Else
me.pagefooter.visible = true
End If

I just wasn't sure where to put it. You're saying the Format event will
recalculate it for each page?


Yes, the Format event is run for every time the section is
processed. The page footer section is processed for every
page.

You code will also work, it's just more lines.
 
Whoops, wasn't quite finished.

Your code could also be shortened to one line:

me.pagefooter.visible = (me.balance > 0)
 
I am still having a problem with it. If one record has a balance of 0 or
less, then the record immediately behind it prints without the page footer
even though it has a positive balance due. Any idea why?
 
Amy said:
I am still having a problem with it. If one record has a balance of 0 or
less, then the record immediately behind it prints without the page footer
even though it has a positive balance due.


You lost me.

Is the balance a field in each record or is it a total of
multiple invoices or the total of a single invoice's line
items?

Describe the report's grouping and where/how new pages are
specified.
 
The report is grouped by company name (to put it in alphabetical order to
match up with cover letters), order ID, and contact name (so that both the
person handling the show and the billing department, if different, get a
copy). The balance is the total of each invoice's line items minus the
payments received. It is calculated in the contact name footer. The new
page is forced after the company name footer, which is otherwise blank.
 
Amy said:
The report is grouped by company name (to put it in alphabetical order to
match up with cover letters), order ID, and contact name (so that both the
person handling the show and the billing department, if different, get a
copy). The balance is the total of each invoice's line items minus the
payments received. It is calculated in the contact name footer. The new
page is forced after the company name footer, which is otherwise blank.


The way I understand that, the page can have multiple
invoices and somehow an invoice with a balance of 0 seems to
go to the next page??

In that kind of situation, shouldn't the balance be the
total of all the customer's invoices?
 
One company can have two copies of the same invoice on separate pages, one
with our contact's information (trade show coordinator for instance) and the
other with their accounts payable information. That way, for companies that
require all bills to go to Accounts Payable directly, we have a copy for
them, but the person actually handling the show gets a copy as his/her space
confirmation. We run them in batches based on the date the booth is
assigned. For some reason, if Company A is paid in full or has overpaid (so
the page footer doesn't print), the page footer on the next invoice, which is
for Company B who has a balance due, doesn't print either.

Am I putting my "force page" in the wrong place?
 
Amy said:
One company can have two copies of the same invoice on separate pages, one
with our contact's information (trade show coordinator for instance) and the
other with their accounts payable information. That way, for companies that
require all bills to go to Accounts Payable directly, we have a copy for
them, but the person actually handling the show gets a copy as his/her space
confirmation. We run them in batches based on the date the booth is
assigned. For some reason, if Company A is paid in full or has overpaid (so
the page footer doesn't print), the page footer on the next invoice, which is
for Company B who has a balance due, doesn't print either.

Am I putting my "force page" in the wrong place?


The ForceNewPage shouldn't interfere with things. The
printing of the page footer is totally controlled by the
balance=0 condition. I don't see how one invoice's balance
can affect another invoice's page footer. Maybe there is
something else going on???
 
I figured it out. On a hunch, I moved the code to the page header's OnFormat
event, and that worked. I think what was happening was that it wasn't
evaluating the instruction until after the page footer was already formatted,
so by the time it evaluated the condition, it was too late to do anything
about it.
 
Amy said:
I figured it out. On a hunch, I moved the code to the page header's OnFormat
event, and that worked. I think what was happening was that it wasn't
evaluating the instruction until after the page footer was already formatted,
so by the time it evaluated the condition, it was too late to do anything
about it.


I don't undrstand that from what you've described, but if it
works, all good.
 
Back
Top