Repeat block of text every other page

A

Andrew_2350

Hi,

I'm trying to create an invoice that will print double-sided. On the front
of each page is printed the actual invoice info, while on the back of each
page I need to repeat the sales contract clauses. Is there any way to do
this in Access?

Any help would be appreciated.
 
A

Allen Browne

For even pages, the remainder left over after dividing by 2 is zero, so:

=IIf([Page] Mod 2 = 0, "This is your contract...", Null)
 
J

Jason W. Martin

Yes there's a way. Have 2 sets of text boxes for page headers or footers,
in the header or footer's section Format event hide/show the corresponding
text box based on the Page property if it's an odd or even number. You can
use the MOD function to determine if you have an odd or even page number
based on if the remainder is whole number.

- Jason
 
M

Marshall Barton

Andrew_2350 said:
I'm trying to create an invoice that will print double-sided. On the front
of each page is printed the actual invoice info, while on the back of each
page I need to repeat the sales contract clauses. Is there any way to do
this in Access?


That's pretty vague, but here's an idea.

Add a text box named txtClauses to the very top of the
detail section. Make it as wide as you need for the clauses
text. It's ok if it's on top of your other controls

Then use code in the detail section's Format event to pull
all the tricks in the book.

If Me.Page Mod 2 = 0 Then
Me.Section(0).Height = 1440 * 9
Me.txtClauses.Height = 1440 * 9
txtA.Visible = False ' Hide your other controls
txtB.Visible = False
. . .
Me.NextRecord = False
Else
Me.txtClauses.Height = 0
Me.Section(0).Height = 0.2 * 1440
txtA.Visible = True ' Show your other controls
txtB.Visible = True
. . .
End If

The 9 is the number of inches on your page less top and
bottom margins. The 0.2 is the normal height of the detail
section in inches. Change these to your actual values.
 
A

Andrew_2350

Thanks for all the suggestions.

Let me clarify what I am trying to do with this invoice. On one side of
every sheet printed there will be the store & customer info (about 3" high)
followed by several line items of varying heights, depending on the options
the customer wants. On the back of each sheet I need a line drawing and
several paragraphs of sales contract, without any headers or footers.

What I finally used is two repeating group headers, the outer one for the
store/customer and the inner one for the contract. I have a copy of the
contract in the report footer, to make sure it gets printed even if there's
only 1 page for the whole report.

I've found that if I try to make Visible=False, or even make Height=0 for
either of the group headers or the page footer, the program goes into an
infinite formatting loop. This happens even if I try to do it from the page
header's Format event (i.e. from outside the report section I'm trying to
affect).

Attached below is the VB code I'm using for this (using Acc2K).

Private Sub secGrpHead_Format(Cancel As Integer, FormatCount As Integer)
'secGrpHead is a group header on invoice #
' visible, canGrow, canShrink, repeatSection, design height 0.25", grows
to 3"
'embrptInvoiceSubHeading is an unlinked one page subreport in secGrpHead
' with the store & customer information

'secContract is a second group header on invoice #
' canGrow, repeatSection, design height 0.25", grows to 9"
'embrptInvoiceSubContract is another one page unlinked subreport
' with the sales contract clauses and some line drawings

If Me.Page Mod 2 = 0 Then 'page 2, 4, 6 - print clauses - hide group
header (store & customer info)
Me.embrptInvoiceSubHeading.Visible = False
Me.secGrpHead.Height = 1440 * 0.00125 'can't make 0, can't make
visible=false, or infinite loop
Me.secContract.Visible = True 'show clauses

Else 'page 1, 3, 5 - print invoice - show group header (store & customer
info)
Me.embrptInvoiceSubHeading.Visible = True 'canGrow, will resize on
its own
Me.secContract.Visible = False 'hide clauses
End If

End Sub



Private Sub secPageFooter_Format(Cancel As Integer, FormatCount As Integer)
'can't hide the section, will lose about 0.25"
Dim c As Control

If (Me.Page Mod 2 = 0) Or Page = Pages Then 'page 2, 4, 6 or report
summary - print clauses - hide page footer
For Each c In Me.secPageFooter.Controls
c.Visible = False
Next c

Else 'page 1, 3, 5 - print invoice - show page footer
For Each c In Me.secPageFooter.Controls
c.Visible = True
Next c
End If

End Sub
 
M

Marshall Barton

Andrew_2350 said:
Let me clarify what I am trying to do with this invoice. On one side of
every sheet printed there will be the store & customer info (about 3" high)
followed by several line items of varying heights, depending on the options
the customer wants. On the back of each sheet I need a line drawing and
several paragraphs of sales contract, without any headers or footers.

What I finally used is two repeating group headers, the outer one for the
store/customer and the inner one for the contract. I have a copy of the
contract in the report footer, to make sure it gets printed even if there's
only 1 page for the whole report.

I've found that if I try to make Visible=False, or even make Height=0 for
either of the group headers or the page footer, the program goes into an
infinite formatting loop. This happens even if I try to do it from the page
header's Format event (i.e. from outside the report section I'm trying to
affect).

Attached below is the VB code I'm using for this (using Acc2K).

Private Sub secGrpHead_Format(Cancel As Integer, FormatCount As Integer)
'secGrpHead is a group header on invoice #
' visible, canGrow, canShrink, repeatSection, design height 0.25", grows
to 3"
'embrptInvoiceSubHeading is an unlinked one page subreport in secGrpHead
' with the store & customer information

'secContract is a second group header on invoice #
' canGrow, repeatSection, design height 0.25", grows to 9"
'embrptInvoiceSubContract is another one page unlinked subreport
' with the sales contract clauses and some line drawings

If Me.Page Mod 2 = 0 Then 'page 2, 4, 6 - print clauses - hide group
header (store & customer info)
Me.embrptInvoiceSubHeading.Visible = False
Me.secGrpHead.Height = 1440 * 0.00125 'can't make 0, can't make
visible=false, or infinite loop
Me.secContract.Visible = True 'show clauses

Else 'page 1, 3, 5 - print invoice - show group header (store & customer
info)
Me.embrptInvoiceSubHeading.Visible = True 'canGrow, will resize on
its own
Me.secContract.Visible = False 'hide clauses
End If

End Sub



Private Sub secPageFooter_Format(Cancel As Integer, FormatCount As Integer)
'can't hide the section, will lose about 0.25"
Dim c As Control

If (Me.Page Mod 2 = 0) Or Page = Pages Then 'page 2, 4, 6 or report
summary - print clauses - hide page footer
For Each c In Me.secPageFooter.Controls
c.Visible = False
Next c

Else 'page 1, 3, 5 - print invoice - show page footer
For Each c In Me.secPageFooter.Controls
c.Visible = True
Next c
End If

End Sub


Because of the looping problem, you can not hide a repeat
section. In A2003, if you try to hide the section, it
doesn't loop, it just turns the repeat section off.

OTOH, you can use the page header's Format event to show or
hide both the page header and footer sections. When you
make the header and footer invisible in the header's Format
event, you can then use their space for other things. This
way you do not need to hide the header footer controls.
 
A

Andrew_2350

Thanks, Marshall

I will give that a try in the next version. Right now it's working, so I
don't want to touch it any more :)
 
F

FDM

I am working on the same type of report - i.e. order details with page
header/footer on odd page numbers, full page "terms" without page
header/footer on even page numbers.

After finding this post, I'm much closer to the format I need, but I'm still
not quite there.

A new issue has me stumped. Print preview shows order details with page
header/footer on page 1, but when I print the report, page 1 prints with
order details to the bottom of the page with no page footer.

Any suggestions?
 
S

Steve

I am working on the same problem as you. the following suppresses the text
boxes OK and suppresses the pageFooter OK. Nothing I have tried will
suppress the pageHeader. I do not know much about Section() other than what
I have read in these groups.

If you can see something else for me to try, please let me know.

TIA

Steve
 
S

Steve

here is the code i forgot before :)

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page Mod 2 = 1)
Me.Section(0).Visible = (Me.Page Mod 2 = 1)
Me.Section(1).Visible = (Me.Page Mod 2 = 1)
Me.Section(2).Visible = (Me.Page Mod 2 = 1)
Me.Section(3).Visible = (Me.Page Mod 2 = 1)

If Me.Page Mod 2 = 0 Then
Me.Section(0).Height = 1440 * 10
Me.txtContract.Height = 1440 * 10
Text117.Visible = False
Text38.Visible = False
[Delivery Method].Visible = False
ItemNumber.Visible = False
ItemDescription.Visible = False
RequestedAmount.Visible = False
UnitOfMeasure.Visible = False
Hours.Visible = False
CustPrice.Visible = False
AllowedQty.Visible = False
CoPay.Visible = False

Me.NextRecord = False
Else
Me.txtContract = 0
Me.Section(0).Height = 0.2 * 1440
Text117.Visible = True
Text38.Visible = True
[Delivery Method].Visible = True
ItemNumber.Visible = True
ItemDescription.Visible = True
RequestedAmount.Visible = True
UnitOfMeasure.Visible = True
Hours.Visible = True
CustPrice.Visible = True
AllowedQty.Visible = True
CoPay.Visible = True
txtContract.Visible = False

Me.NextRecord = True

End If
End Sub
 
S

Steve

This code works as Marshall said it would. My problem is how to trigger the
second page if the first page only has a couple of line items on it..

Thanks

Steve

Steve said:
here is the code i forgot before :)

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page Mod 2 = 1)
Me.Section(0).Visible = (Me.Page Mod 2 = 1)
Me.Section(1).Visible = (Me.Page Mod 2 = 1)
Me.Section(2).Visible = (Me.Page Mod 2 = 1)
Me.Section(3).Visible = (Me.Page Mod 2 = 1)

If Me.Page Mod 2 = 0 Then
Me.Section(0).Height = 1440 * 10
Me.txtContract.Height = 1440 * 10
Text117.Visible = False
Text38.Visible = False
[Delivery Method].Visible = False
ItemNumber.Visible = False
ItemDescription.Visible = False
RequestedAmount.Visible = False
UnitOfMeasure.Visible = False
Hours.Visible = False
CustPrice.Visible = False
AllowedQty.Visible = False
CoPay.Visible = False

Me.NextRecord = False
Else
Me.txtContract = 0
Me.Section(0).Height = 0.2 * 1440
Text117.Visible = True
Text38.Visible = True
[Delivery Method].Visible = True
ItemNumber.Visible = True
ItemDescription.Visible = True
RequestedAmount.Visible = True
UnitOfMeasure.Visible = True
Hours.Visible = True
CustPrice.Visible = True
AllowedQty.Visible = True
CoPay.Visible = True
txtContract.Visible = False

Me.NextRecord = True

End If
End Sub



Steve said:
I am working on the same problem as you. the following suppresses the text
boxes OK and suppresses the pageFooter OK. Nothing I have tried will
suppress the pageHeader. I do not know much about Section() other than what
I have read in these groups.

If you can see something else for me to try, please let me know.

TIA

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top