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

Total Number of pages from all reports

Status
Not open for further replies.

mrathi

Technical User
Oct 27, 2003
115
US
Hi, I have a command button that will print several reports and the number of pages in each report will vary each time. Is there a way to find the total number of pages from all the reports? Basically, currently I am giving the user a warning saying that it could be several pages, however, I was wondering, if it is possible to tell the user exactly how many pages.

Thanks
 
Ok, here is what I did in the past... I knew that my report displayed approximately 30 rows of data. I would write an SQL Count(*) to see how many records were returned, then divided by 30 to get a estimated page count... htwh,


Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Private Sub Command17_Click()

Dim Msg, Style, Title, Response, MyString
Msg = "This will Print the entire Application." + Chr(13) + "The number of Pages may vary. It could be several pages." + Chr(13) + "Do you want to continue ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Warning"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
On Error Resume Next

DoCmd.OpenReport "MrptFacilityInformation"
DoCmd.OpenReport "MrptFacilityContacts"
DoCmd.OpenReport "MrptBFacilityEm"
DoCmd.OpenReport "MrptRuleApp"

If Err = 2501 Then Err.Clear

Else ' User chose No.
MyString = "No" ' Perform some action.
End If

End Sub
 
Well in my example, one approach is to ...
-> psuedo code
Dim lcSQL as String
Dim thisDB as DAO.Database
Dim rs as DAO.recordset
Dim lnPageCnt as Double
Set thisdb=currentdb
lnPageCnt=0

lcSQL= Select count(*) as Rec_Cnt from first report table and Where Clause.
Set rs = createrecordset...(lcSQL, snapshot)
lnPageCnt = lcPageCnt + (rs("Rec_Cnt")/30) 'May need to round?


lcSQL= Select count(*) as Rec_Cnt from 2nd report table and Where Clause.
Set rs = createrecordset...(lcSQL, snapshot)
lnPageCnt = lcPageCnt + (rs("Rec_Cnt")/30) 'May need to round?


lcSQL= Select count(*) as Rec_Cnt from 3rd report table and Where Clause.
Set rs = createrecordset...(lcSQL, snapshot)
lnPageCnt = lcPageCnt + (rs("Rec_Cnt")/30) 'May need to round?

lcSQL= Select count(*) as Rec_Cnt from 4th report table and Where Clause.
Set rs = createrecordset...(lcSQL, snapshot)
lnPageCnt = lcPageCnt + (rs("Rec_Cnt")/30) 'May need to round?



-> Before Here
DoCmd.OpenReport "MrptFacilityInformation"
DoCmd.OpenReport "MrptFacilityContacts"
DoCmd.OpenReport "MrptBFacilityEm"
DoCmd.OpenReport "MrptRuleApp"

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Well it seems to depend on the size of the report. I was able to pick up the value of Pages in some reports but not others. I'll look it over some more this evening. Steve's idea may be a reasonable alternative.

Paul
 
That is correct. The number of pages for example in the last report vary anywhere from pages 1 to 10 depending on what the user selected when filling the forms.

Thanks.
 
??
Is this possible? All my reports are already ready by the time the user will hit this button. I mean, if I open my reports individually, it tells me how many pages are there in that particular report, unless there is no "no data". Now, when the user clicks the print all button, can I just total the pages of the reports?? I don't know, maybe you geniuses can help :)
 
Is this possible? I create another report with no data at all. And then just include all my reports as sub reports in the main. Give a page count for the main report?? Will this work?
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top