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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Event When the Page Number Changes

Status
Not open for further replies.

Quintios

Technical User
Mar 7, 2002
482
0
0
US
I have a large report composed of several smaller reports. They print out in sequence and then start over again because of the way they are sorted.

One of the reports formatted similar to a datasheet. I have it programmed such that this report will skip every X lines to make it easier to read. X is dependent on several things and changes throughout the report (spent most of the day figuring that one out!)

The problem is that I need to know when the page breaks naturally in the middle of this subreport. When the page breaks I need to skip the 'detail_format' sub; otherwise it will set the formatting off on the subsequent pages.

So, is there an event or some sort of property of a report that tells you when a page break happens?

Thanks so much for your help!!
Onwards,

Q-
 
I don't know if this is the right way or area to write my question.
I wrote a very sample access97 database, and I need to make this database generate a report, based on the User's needs.
This is a production line where there will be similar product runs.
I need my database to ask the User "[enter part number]", and my User be able to input as many part numbers as He/She needs to, then database should generate/print out a report based only on the part numbers He/She entered.
The database is a "BILL OF MATERIALS" for parts selected, is a 4 pages report, grouped by selected part numbers.
Any help would be greatly appreciated..Thanks Al
 
Quintios
Look up the HasContinued/WillContinue functions
 
student03,

Start your own thread. :) Check out the FAQ area for suggestions as to how to get the most responses.
Onwards,

Q-
 
OK, I'll hopefully find it in the help files soon, but I'd appreciate it if someone could fill me in on the syntax for the HasContinued/WillContinue properties.

Thx.
Onwards,

Q-
 
OK, the HasContinued and WillContinue properties are not working for me. Here's the sub:

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim boolPageChange As Boolean
Dim boolPageChange2 As Boolean
    
    boolPageChange = Section(acDetail).HasContinued
    boolPageChange2 = Section(acDetail).WillContinue
    
    Debug.Print "HasContinued? " & boolPageChange
    Debug.Print "WillContinue? " & boolPageChange2

Obviously it's not the complete sub. :) Those properties never change. I'm in the detail_format section of this report and I need to know when the page break happens, but I'm not getting the information I need from this.

Is there any other way? Is there some other property I have to have enabled or disabled in the report to get these to work?

Thanks in advance,
Onwards,

Q-
 
Hi Q!

You could try this:

Declare a static variable in your procedure and store the page number in the variable:

If PageNumber = 1 Then
YourVariable = 1
End If

Then you can check for a change:

If YourVariable <> PageNumber Then
YourVariable = PageNumber
Else
Do your other stuff here
End If

If I remember correctly you can't directly access the page number from VBA but you can create an invisible text box to hold the page number and use that for the test. As you can probably tell, I haven't tested this or ever used it but I hope it at least points you in a usable direction.

Jeff Bridgham
bridgham@purdue.edu
 
I think that might be the problem as to why I was getting zeros when I put the page number in the message box. The report itself is simply:

Headers
Info
Info
Info

Maybe if I put the invisible text box in there I could get the page number out.

Like I said, I have the report working in stand-alone mode, it just screws up when I stick it in the big report. I'll go play with that idea and if doesn't work I'll write back.

Thanks for your help!
Onwards,

Q-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top