preferred method to filter Lebans' ReportToPdf

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rquintal@sympatico.ca

    preferred method to filter Lebans' ReportToPdf

    I could not find a good method to pass a where clause or openargs to a
    report named in a call to stephen Lebans' fine reportToPDF utility.l.

    Do you have a good method to pass a PK to the report so you can print
    a single record to an individual pdf?.

    I've got 2500 records to make into .pdfs, (project manager says it's
    what customer wants)
    and I've put the report2pdf call inside a loop. It works, but ignores
    any filter clause I try to pass (using a one field, on record table,
    or a public variable or a query criteria to a form, etc...

    Thanks

    Bob Q

  • Albert D. Kallal

    #2
    Re: preferred method to filter Lebans' ReportToPdf

    "rquintal@sympa tico.ca" <bob.quintal@gm ail.comwrote in message
    news:ae69db4a-3975-4c90-9671-1d793e2a9ee9@m4 4g2000hsc.googl egroups.com...
    >I could not find a good method to pass a where clause or openargs to a
    report named in a call to stephen Lebans' fine reportToPDF utility.l.
    >
    Do you have a good method to pass a PK to the report so you can print
    a single record to an individual pdf?.
    Yes, just open the report BEFORE you call the pdf routines.

    eg:
    strReportName = "rptInvoice "

    DoCmd.OpenRepor t strReportName, acViewPreview, , strWhere
    Reports(strRepo rtName).Visible = False
    Call ConvertReportTo PDF(strReportNa me, , strDocName, False, False)

    DoCmd.Close acReport, strReportName

    Note how the "strwhere" could be for the current reocrd

    strWhere = "id = " & me!id

    And, don't forget to "close" the report as above after you are done...

    So, open the report with all of your filter options etc BEFORE you call the
    pdf routines.....


    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKa llal@msn.com
    >

    Comment

    • Salad

      #3
      Re: preferred method to filter Lebans' ReportToPdf

      rquintal@sympat ico.ca wrote:
      I could not find a good method to pass a where clause or openargs to a
      report named in a call to stephen Lebans' fine reportToPDF utility.l.
      >
      Do you have a good method to pass a PK to the report so you can print
      a single record to an individual pdf?.
      >
      I've got 2500 records to make into .pdfs, (project manager says it's
      what customer wants)
      and I've put the report2pdf call inside a loop. It works, but ignores
      any filter clause I try to pass (using a one field, on record table,
      or a public variable or a query criteria to a form, etc...
      >
      Thanks
      >
      Bob Q
      >
      I coded something for his program just today. I have a report that can
      be called from several forms. There's only 1 form that will be calling
      the routine to create the PDF file. So in my OnOpen event of the report
      I did something like
      If IsLoaded("formn ame") then 'google for example of isloaded()
      If not isnull(Forms!Fo rmName!ReportFi lter) then
      Me.Filter = Forms!FormName! ReportFilter
      Me.FilterOn = True
      Endif
      Endif

      Then in my routine to call Stephen Lebans code it's something like this
      Dim blnOK As Boolean
      Forms!MainForm! ReportFilter = "CustomerID = 1"
      blnOK = ConvertReportTo PDF...
      Forms!MainForm! ReportFilter = Null

      Stephen's code works like a charm.

      Comment

      • Tony Toews [MVP]

        #4
        Re: preferred method to filter Lebans' ReportToPdf

        Salad <oil@vinegar.co mwrote:
        >So in my OnOpen event of the report
        >I did something like
        > If IsLoaded("formn ame") then 'google for example of isloaded()
        > If not isnull(Forms!Fo rmName!ReportFi lter) then
        > Me.Filter = Forms!FormName! ReportFilter
        > Me.FilterOn = True
        > Endif
        > Endif
        >
        >Then in my routine to call Stephen Lebans code it's something like this
        > Dim blnOK As Boolean
        > Forms!MainForm! ReportFilter = "CustomerID = 1"
        > blnOK = ConvertReportTo PDF...
        > Forms!MainForm! ReportFilter = Null
        >
        >Stephen's code works like a charm.
        I use something very similar. Except that I use a Global Options Hidden form bound
        to a global options table on which I throw a tab control. And I put miscellanious
        fields such as the one Salad uses as well.

        This form also takes care of the performance problem issue.

        Tony
        --
        Tony Toews, Microsoft Access MVP
        Please respond only in the newsgroups so that others can
        read the entire thread of messages.
        Microsoft Access Links, Hints, Tips & Accounting Systems at

        Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

        Comment

        • rquintal@sympatico.ca

          #5
          Re: preferred method to filter Lebans' ReportToPdf

          On Sep 23, 6:58 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
          Salad <o...@vinegar.c omwrote:
          So in my OnOpen event of the report
          I did something like
             If IsLoaded("formn ame") then  'google for example of isloaded()
                     If not isnull(Forms!Fo rmName!ReportFi lter) then
                             Me.Filter = Forms!FormName! ReportFilter
                             Me.FilterOn = True
                     Endif
             Endif
          >
          Then in my routine to call Stephen Lebans code it's something like this
             Dim blnOK As Boolean
             Forms!MainForm! ReportFilter = "CustomerID = 1"
             blnOK = ConvertReportTo PDF...
             Forms!MainForm! ReportFilter = Null
          >
          Stephen's code works like a charm.
          >
          I use something very similar.  Except that I use a Global Options Hidden form bound
          to a global options table on which I throw a tab control.   And I put miscellanious
          fields such as the one Salad uses as well.
          >
          This form also takes care of the performance problem issue.
          >
          Tony
          --
          Tony Toews, Microsoft Access MVP
             Please respond only in the newsgroups so that others can
          read the entire thread of messages.
             Microsoft Access Links, Hints, Tips & Accounting Systems athttp://www.granite.ab. ca/accsmstr.htm
             Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/- Hide quoted text -
          >
          - Show quoted text -
          Thanks to all 3 of you for your responses. Albert's method worked
          beautifully, although I'm surprised at the fact that opening an open
          form respects the filter on the first form, instead of the form
          defaults.

          However, I do intend to update the code to use Salad's and your method
          mecause I find the flickering of the report being opened, closed and
          reopened 2022 times a little annoying.

          As to performance, it took about 20 minutes to create the 2000+ .PDFs,
          2 to 5 pages each.

          Q

          Comment

          • Tony Toews [MVP]

            #6
            Re: preferred method to filter Lebans' ReportToPdf

            "rquintal@sympa tico.ca" <bob.quintal@gm ail.comwrote:
            >As to performance, it took about 20 minutes to create the 2000+ .PDFs,
            >2 to 5 pages each.
            So a hundred a minute isn't bad at all. Gotta love Stephen's solution. I sure do!

            Tony
            --
            Tony Toews, Microsoft Access MVP
            Please respond only in the newsgroups so that others can
            read the entire thread of messages.
            Microsoft Access Links, Hints, Tips & Accounting Systems at

            Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

            Comment

            • rquintal@sympatico.ca

              #7
              Re: preferred method to filter Lebans' ReportToPdf

              On Sep 24, 6:37 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
              "rquin...@sympa tico.ca" <bob.quin...@gm ail.comwrote:
              As to performance, it took about 20 minutes to create the 2000+ .PDFs,
              2 to 5 pages each.
              >
              So a hundred a minute isn't bad at all.   Gotta love Stephen's solution..  I sure do!
              >
              Tony
              He's da man!

              Thanks Stephen, for all your fine work.

              Comment

              • Albert D. Kallal

                #8
                Re: preferred method to filter Lebans' ReportToPdf

                "rquintal@sympa tico.ca" <bob.quintal@gm ail.comwrote in message
                news:2e770bd9-0f23-47e9-837a-65500ac156c6@m3 6g2000hse.googl egroups.com...
                On Sep 24, 6:37 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
                "rquin...@sympa tico.ca" <bob.quin...@gm ail.comwrote:
                As to performance, it took about 20 minutes to create the 2000+ .PDFs,
                2 to 5 pages each.
                >>
                >So a hundred a minute isn't bad at all. Gotta love Stephen's solution. I
                >sure do!
                >>
                >Tony
                >He's da man!
                >Thanks Stephen, for all your fine work.

                Yes, I have to throw in a big thanks to that Stephen guy.....it is a fab pdf
                maker.....



                --
                Albert D. Kallal (Access MVP)
                Edmonton, Alberta Canada
                pleaseNOOSpamKa llal@msn.com


                Comment

                Working...