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

Page Numbering & Continued Next Page

Status
Not open for further replies.

AmandaKelly

Technical User
Jun 26, 2004
1
GB
Hi,
Help would be much appreciated.
My objective is to print invoices according to Invoice Name.
My set-up is as follows:
Report Header
Page Header
Invoice Name Header
Details
Invoice Name Footer
Page Footer
Report Footer.
I need to format Page Numbering according to Invoice Name if more than one page (i.e. Mr Smith Page 1 of 3 - Mr Bloggs Page 1 of 6 etc...) with "Continued Next Page" and "SubTotal" at the bottom of each page, "Balance Forward" at the top of each next page, with the last page printing Total.
Furthermore, the Page Numbering should go back to Page 1 of 6 for Mr Bloggs etc...
I have tried this with "row count" idea but in my case it does not work because in Details, I need textboxes with "Can Grow" option to Yes, hence 1 row can have 1 or more lines.
The option I am thinking of is "Lines=(Count)".
Any suggestions how to write the VB Code Please.
Amanda
 
Amanda,

One option is to put the "Work" somewhere else. Instead of trying to get a single report to format individual groups as though they were individual reports, try this:

Setup the report as though it really is a single invoice.
Have the Print function go to a hidden form instead of the report and send the "filter" as the open arguments.

In this hidden form's On_Open event, open a single field recordset for the key value of the report's data (each invoice) using the filter that was originally planned for the report (all invoices this week, for example). Use a loop to loop through this recordset and print each invoice.
Code:
Private Sub Form_Open(Cancel As Integer)
    Dim rsDat As DAO.Recordset
    Dim strSQL As String
    strSQL = "Select KeyField From qryInvoices"
    If Len(Me.OpenArgs & "") > 0 Then
        strSQL = strSQL & " Where " & Me.OpenArgs
    End If
    Set rsDat = Currentdb.OpenRecordset(strSQL)
    If rsDat.RecordCount = 0 Then
        MsgBox "There were no records!",vbOkOnly,"No Data!"
        Set rsDat = Nothing
        Cancel = True
    End If
    While Not rsDat.EOF
        strSQL = "KeyField = " & Format(rsDat(0))
        DoCmd.OpenReport "InvoiceReport", acViewNormal, , strSQL
        rsDat.MoveNext
    Wend
    Set rsDat = Nothing
    Cancel = True
Exit Sub

Good luck and have fun


PS: wrote this on the fly so there may be a typo or two
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top