Concecutive page numbers across differnet reports?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I have a series of reports that I need to run. however they need to have
concecutive page numbers. Is there a way to have all my reports i need to run
in a macro and have the page numbers be concecutive across all the reports?

Thanks much,
 
Hello all,

I have a series of reports that I need to run. however they need to have
concecutive page numbers. Is there a way to have all my reports i need to run
in a macro and have the page numbers be concecutive across all the reports?

Thanks much,

Make a table to hold the last page number of each report.
Table name "tblPage"
All you need is one field:
"intPageNumber" Number datatype, Integer

Next, enter a 0 (Zero) into the field as a starter number.

Now in each report, Dim a variable in the declarations section:

Option Compare Database
Option Explicit
Dim intLastPage as Integer

Code each report's Open event:
intLastPage = DLookUp("intPageNumber","tblPage")

Code each Report's Report Header Format event:
[Page] = [Page] + intLastPage

Code each Report's Report Footer Print event:

DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = " & [Page] &
";"
Docmd.SetWarnings True

Each report should pick up the ending page of the previous report and
increment it by 1.
Note: You'll not be able to use the [Pages] property in any of these
reports, i.e. ="Page " & [Page] & " of " & [Pages] as you'll get
something like "Page 32 of 4".

You must enter a 0 in the table at the start of each batch of reports.
If there is always one same report which is run first in the batch,
just use a RunSQL in the first Report's Open event (before anything
else):

DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = 0;"
Docmd.SetWarnings True

to reset the field to zero.

If the Reports are in run in random order, manually (or otherwise)
enter a 0 into that table field before starting.
 
Thanks Fred,

A bit of the stuff is a bit above my head at the moment, but it gives me the
direction to head in. I may be back with other questions when i get stuck.

Thanks again,
--
Mark


fredg said:
Hello all,

I have a series of reports that I need to run. however they need to have
concecutive page numbers. Is there a way to have all my reports i need to run
in a macro and have the page numbers be concecutive across all the reports?

Thanks much,

Make a table to hold the last page number of each report.
Table name "tblPage"
All you need is one field:
"intPageNumber" Number datatype, Integer

Next, enter a 0 (Zero) into the field as a starter number.

Now in each report, Dim a variable in the declarations section:

Option Compare Database
Option Explicit
Dim intLastPage as Integer

Code each report's Open event:
intLastPage = DLookUp("intPageNumber","tblPage")

Code each Report's Report Header Format event:
[Page] = [Page] + intLastPage

Code each Report's Report Footer Print event:

DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = " & [Page] &
";"
Docmd.SetWarnings True

Each report should pick up the ending page of the previous report and
increment it by 1.
Note: You'll not be able to use the [Pages] property in any of these
reports, i.e. ="Page " & [Page] & " of " & [Pages] as you'll get
something like "Page 32 of 4".

You must enter a 0 in the table at the start of each batch of reports.
If there is always one same report which is run first in the batch,
just use a RunSQL in the first Report's Open event (before anything
else):

DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = 0;"
Docmd.SetWarnings True

to reset the field to zero.

If the Reports are in run in random order, manually (or otherwise)
enter a 0 into that table field before starting.
 
Fred:

I tried to do this and now my report won't open at all except in design
mode. An example of the what I did:

Option Compare Database
Option Explicit
Dim intLastPage As Integer

Private Sub Report_Open(Cancel As Integer)

intLastPage = DLookup("intPageNumber", "pagenumber")

End Sub

Private Sub ReportFooter_Print(Cancel As Integer, PrintCount As Integer)

DoCmd.SetWarnings False
DoCmd.RunSQL "Update pagenumber Set pagenumber.intPageNumber = " &
[page] & ";"
DoCmd.SetWarnings True

End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

[page] = [page] + intLastPage

End Sub

"pagenumber" is my table. Any help you can give would be great.


Mark Haley said:
Thanks Fred,

A bit of the stuff is a bit above my head at the moment, but it gives me the
direction to head in. I may be back with other questions when i get stuck.

Thanks again,
--
Mark


fredg said:
Hello all,

I have a series of reports that I need to run. however they need to have
concecutive page numbers. Is there a way to have all my reports i need to run
in a macro and have the page numbers be concecutive across all the reports?

Thanks much,

Make a table to hold the last page number of each report.
Table name "tblPage"
All you need is one field:
"intPageNumber" Number datatype, Integer

Next, enter a 0 (Zero) into the field as a starter number.

Now in each report, Dim a variable in the declarations section:

Option Compare Database
Option Explicit
Dim intLastPage as Integer

Code each report's Open event:
intLastPage = DLookUp("intPageNumber","tblPage")

Code each Report's Report Header Format event:
[Page] = [Page] + intLastPage

Code each Report's Report Footer Print event:

DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = " & [Page] &
";"
Docmd.SetWarnings True

Each report should pick up the ending page of the previous report and
increment it by 1.
Note: You'll not be able to use the [Pages] property in any of these
reports, i.e. ="Page " & [Page] & " of " & [Pages] as you'll get
something like "Page 32 of 4".

You must enter a 0 in the table at the start of each batch of reports.
If there is always one same report which is run first in the batch,
just use a RunSQL in the first Report's Open event (before anything
else):

DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = 0;"
Docmd.SetWarnings True

to reset the field to zero.

If the Reports are in run in random order, manually (or otherwise)
enter a 0 into that table field before starting.
 
Back
Top