Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    2

    Unanswered: Send Object with Filter

    I am have a report filtered by a form select using the code below:

    Private Sub preview_Click()
    On Error GoTo Err_preview_Click

    Dim stDocName As String

    strWhichFilter = "SALES_ID = Forms![frm_RepsSelect]!SalesRep"
    stDocName = "rpt_SalesResultsSummary_PDA"
    DoCmd.OpenReport stDocName, acPreview, , strWhichFilter

    Exit_preview_Click:
    Exit Sub

    Err_preview_Click:
    MsgBox Err.Description
    Resume Exit_preview_Click

    End Sub

    What I now want to do is create a send object in HTML format to send this report to each rep. How can I apply the same filtering as above to achieve this.

    Any assistance would be appreciated.

  2. #2
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Make your Report RecordSource a query, qryReport. Then you can set the SQL property before opening the report or using the SendObject method:

    qryReport.SQL = "SELECT... FROM... WHERE (((SALES_ID)=" & Forms![frm_RepsSelect]!SalesRep & "));"

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Thank you for your assistance, much appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •