Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Page Break During Format 2

Status
Not open for further replies.

SgtJarrow

Programmer
Apr 12, 2002
2,937
US
Access 97

I am importing a Word doc that contains page breaks. While importing, the page breaks are converted into an Unicode (I think) character (looks like a square). The data is then displayed into a report that contains only one field, called Entry. What I need to happen is any time the Entry field contains only the character, a page break or go to next page is applied. I've got the evaluation part complete, but I am looking for a way to force a page break dynamically using the OnFormat property of the report. DoCmd.GoToPage does not work....

Any ideas? Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
Robert,

From Access help:
Code:
Use Visual Basic to force a page break in a report if a condition is met

1	Open the report in Design view.
2	In the toolbox, click Page Break  , then click in the report section where you want a conditional page break.
3	Open the report's PageHeader_Format event procedure.

How?

4	In the event procedure, add an assignment statement that sets the Visible property of the page break control to No. For example, if the name of the control is CondPgBreak, add the following assignment statement:

Me![CondPgBreak].Visible = False

This hides the page break control when the report starts formatting each page, so the page doesn't break.

5	In the Format event procedure of the section where you placed the page break, add Visual Basic code that sets the Visible property to Yes when a condition is met. For example, suppose you want a page break to occur in the detail section of the report if the value of the Counter control is 10, so that the first 10 records will print on the first page. Add the following code to the Detail_Format event procedure:

If Me![Counter] = 10 Then
	Me![CondPgBreak].Visible = True
End If

When the condition is met, the page breaks. After the page is broken, the event procedure attached to the page header hides the page break control until the condition is met again.

Hope this helps.......
 
CosmoKramer,

Wow! That works perfectly.....I knew about this procedure (I've used it many a time), but didn't think to try it with a page break.......

Thanks! Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top