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

Email report with criteria

Status
Not open for further replies.

Moxy1

Programmer
Aug 29, 2002
75
US
Currently I have a report that is open with the following code:

Code:
Private Sub Command242_Click()
Dim strCriteria As String


strCriteria = "[Status]='O'"
    
DoCmd.OpenReport "rptAllIssuesUnion", , , strCriteria

End Sub

Is there a way to send this same report through an email? When I use SendObject there is no spot for the criteria.

Thanks
 
* If you use a small form for the criteria, you can reference it in the query on which you buit the report.

* You can rebuild the query for the report programmatically.

* You can modify the record source of the report programmatically.

I think that's most of the options.
 
if either the 2nd or 3rd option is taken where/how would these be changed? Is it on one of the events of the report or here in the code that launches the report?
 
Just before launching the report is good. Here is an example of option 2:

Code:
    strSQL = "Select * From tblTable Where "
    strSQL = strSQL & strFilter
    If DLookup("Name", "MSysObjects", "Name= 'RptQry'") <> "" Then
        Set qdf = CurrentDb.QueryDefs("RptQry")
        qdf.SQL = strSQL
    Else
        Set qdf = CurrentDb.CreateQueryDef("RptQry", strSQL)
    End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top