• Print a report based on a filter by form

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Print a report based on a filter by form

    Author
    Topic
    #465890

    Is there an easy way to take the filtered results of a filter by form and use that recordset as the basis for a hard-copy report (specifically a phone list). For example, my client might want a phone list of all the clients who speak Spanish and Portuguese or women in certain postal codes. I need to be quite flexible in the possibilities. Since I already have a working filter form, it is just a question of grabbing the filtered recordset. Any points in the right direction would be appreciated.

    Viewing 1 reply thread
    Author
    Replies
    • #1205014

      When you filter a form, the filter is accessible as a string via me.filter.

      When you preview (or print) a report you can apply a Where clause to limit the report to records that match the criteria of the Where clause.

      So you can use the form filter as the Where clause.

      e.g. (air code)

      Code:
      Dim strfilter as string
      Dim strReport as string
      strfilter = me.filter
      strReport = "rptSomeReport"
      Docmd.OpenReport strReport, acViewPreview, ,strfilter
    • #1205072

      Thanks, John. That is what I was hoping to find out. I’ll post back if I have any questions.

      Peter

    Viewing 1 reply thread
    Reply To: Print a report based on a filter by form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: