Different footers in reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bijondhanbad
    New Member
    • Sep 2006
    • 8

    Different footers in reports

    I want to have different footers in different copies of the same page. Like while printing an invoice, I want CUSTOMER COPY on one copy, SELLER COPY on the second copy, OFFICE COPY on the third copy of the invoice.

    How do I do it?
    Will someone help..

    Regards,
    Bijon
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Originally posted by bijondhanbad
    I want to have different footers in different copies of the same page. Like while printing an invoice, I want CUSTOMER COPY on one copy, SELLER COPY on the second copy, OFFICE COPY on the third copy of the invoice.

    How do I do it?
    Will someone help..

    Regards,
    Bijon
    Make 3 copies of the report and use them as sub reports in a larger report.

    Comment

    • puppydogbuddy
      Recognized Expert Top Contributor
      • May 2007
      • 1923

      #3
      Originally posted by Rabbit
      Make 3 copies of the report and use them as sub reports in a larger report.
      Another alternative:

      Create the multiple prints in code with a For/Next Loop. Use an unbound textbox named txtReportTitle with its “can grow” property set to yes to change Title for each copy. Replace "YourFormReport " with the actual name of your report.

      Code:
      Private Sub btnInvoicePrint_Click()
      
      Dim x as Integer                   ‘loop counter
      
      For x = 1 to 3
      	If x = 1 then
      		txtReportTitle.Value = “Customer Copy”
      	ElseIf x = 2 then
      		txtReportTitle.Value = “Seller Copy”
      	ElseIf x = 3 Then
      		txtReportTitle.Value = “Office Copy”
      	Else
      		Exit Sub
      	End If
      	DoCmd.OpenReport “yourFormReport”, acViewNormal
      Next x
      
      End Sub

      Comment

      • bijondhanbad
        New Member
        • Sep 2006
        • 8

        #4
        Tried this out.
        Everytime it is giving an error--- Object required.
        On debugging, it points to the line : txtReportTitle. Value = “Customer Copy”

        Please help
        regards
        bijon

        Originally posted by puppydogbuddy
        Another alternative:

        Create the multiple prints in code with a For/Next Loop. Use an unbound textbox named txtReportTitle with its “can grow” property set to yes to change Title for each copy. Replace "YourFormReport " with the actual name of your report.

        Code:
        Private Sub btnInvoicePrint_Click()
        
        Dim x as Integer                   ‘loop counter
        
        For x = 1 to 3
        	If x = 1 then
        		txtReportTitle.Value = “Customer Copy”
        	ElseIf x = 2 then
        		txtReportTitle.Value = “Seller Copy”
        	ElseIf x = 3 Then
        		txtReportTitle.Value = “Office Copy”
        	Else
        		Exit Sub
        	End If
        	DoCmd.OpenReport “yourFormReport”, acViewNormal
        Next x
        
        End Sub

        Comment

        • puppydogbuddy
          Recognized Expert Top Contributor
          • May 2007
          • 1923

          #5
          Originally posted by bijondhanbad
          Tried this out.
          Everytime it is giving an error--- Object required.
          On debugging, it points to the line : txtReportTitle. Value = “Customer Copy”

          Please help
          regards
          bijon
          Did you go into design view and add an unbound textbox, and set its name property to txtReportTitle?

          If you did the above and it is not working, let me know.

          Comment

          • bijondhanbad
            New Member
            • Sep 2006
            • 8

            #6
            Added an unbound textbox in the Report footer section with that name.Set the CanGrow property to yes and tried it out.
            Doesn't work.
            Please help.
            bijon

            Originally posted by puppydogbuddy
            Did you go into design view and add an unbound textbox, and set its name property to txtReportTitle?

            If you did the above and it is not working, let me know.

            Comment

            • puppydogbuddy
              Recognized Expert Top Contributor
              • May 2007
              • 1923

              #7
              Originally posted by bijondhanbad
              Added an unbound textbox in the Report footer section with that name.Set the CanGrow property to yes and tried it out.
              Doesn't work.
              Please help.
              bijon
              I think the problem is that the title needs to inserted in the Report's open event, and therefore two event procedures are required...one for the button click to print the report and a separate sub for the insertion of the txtTitle during the report's open event. See the code for the two procedures below.

              Code:
              Private Sub btnInvoicePrint_Click()
              Dim x as Integer                   ‘loop counter
               
              For x = 1 to 3
                  DoCmd.OpenReport “yourFormReport”, acViewNormal
              Next x
              End Sub
              _______________ _______________ __________
              Code:
              Private Sub Report_Open(Cancel As Integer)
              Dim x as Integer                   ‘loop counter
               
              For x = 1 to 3
                  If x = 1 then
                      txtReportTitle.Value = “Customer Copy”
                  ElseIf x = 2 then
                      txtReportTitle.Value = “Seller Copy”
                  ElseIf x = 3 Then
                      txtReportTitle.Value = “Office Copy”
                  Else
                      Exit Sub
                  End If
              Next x
               
              End Sub

              Comment

              • bijondhanbad
                New Member
                • Sep 2006
                • 8

                #8
                It doesn't work still.
                I tried another way. I deleted the second code from the report On Open event and pasted it on the Page footer "On print" event.

                This time, however, it is asking for the invoice no on three different occassions but every time the footer comes out as Office Copy and not as desired.

                Please try it out

                Regards
                bijon

                Comment

                • puppydogbuddy
                  Recognized Expert Top Contributor
                  • May 2007
                  • 1923

                  #9
                  Originally posted by bijondhanbad
                  It doesn't work still.
                  I tried another way. I deleted the second code from the report On Open event and pasted it on the Page footer "On print" event.

                  This time, however, it is asking for the invoice no on three different occassions but every time the footer comes out as Office Copy and not as desired.

                  Please try it out

                  Regards
                  bijon
                  Ok. I tested the following code and it works on Access 2000:
                  Code:
                  Private Sub btnInvoicePrint_Click()
                  Dim x As Integer      'loop counter
                  
                  For x = 1 To 3
                  Me.Painting = False
                    DoCmd.OpenReport "YourInvoiceReport", acViewPreview
                      If x = 1 Then
                          Reports!YourInvoiceReport!txtReportTitle.Value = "Customer Copy"
                      ElseIf x = 2 Then
                          Reports!YourInvoiceReport!txtReportTitle.Value = "Seller Copy"
                      ElseIf x = 3 Then
                          Reports!YourInvoiceReport!txtReportTitle.Value = "Office Copy"
                      Else
                          Exit Sub
                      End If
                    DoCmd.OpenReport "YourInvoiceReport", acViewNormal
                    DoEvents
                  Me.Painting = True
                  Next x
                  
                  End Sub

                  Comment

                  Working...